def _is_allowed(self, permission):
    if ('permissions' not in session):
        return True
    permissions = session['permissions']
    if (permissions is None):
        return True
    if self._permission_match(permission, permissions):
        return True
    if self._permission_match(self.ADMIN_PERMISSION, permissions):
        return True
    return self._permission_match(self._admin_permission_for_context(permission.context_id), permissions)
def _is_allowed(self, permission):
    if ('permissions' not in session):
        return True
    permissions = session['permissions']
    if (permissions is None):
        return True
    if self._permission_match(permission, permissions):
        return True
    if self._permission_match(self.ADMIN_PERMISSION, permissions):
        return True
    return self._permission_match(self._admin_permission_for_context(permission.context_id), permissions)