'List of modules to hide from the main menu'

def hidden_modules(self):

    hidden_modules = []
    if self.use_cacls:
        sr = self.auth.get_system_roles()
        modules = current.deployment_settings.modules
        restricted_modules = [m for m in modules if modules[m].restricted]
        roles = []
        if (current.session.s3 is not None):
            roles = (current.session.s3.roles or [])
        if ((sr.ADMIN in roles) or (sr.EDITOR in roles)):
            return []
        if (not roles):
            hidden_modules = restricted_modules
        else:
            t = self.table
            query = (((t.deleted != True) & t.controller.belongs(restricted_modules)) & (t.tablename == None))
            if roles:
                query = (query & t.group_id.belongs(roles))
            else:
                query = (query & (t.group_id == None))
            rows = current.db(query).select()
            acls = dict()
            for acl in rows:
                if (acl.controller not in acls):
                    acls[acl.controller] = self.NONE
                acls[acl.controller] |= (acl.oacl | acl.uacl)
            hidden_modules = [m for m in restricted_modules if ((m not in acls) or (not acls[m]))]
    return hidden_modules
