def decorator(endpoint, pid_value, **kwargs): cache_key = 'editor-permission-{0}-{1}'.format(endpoint, pid_value) is_allowed = session.get(cache_key) if is_allowed is not None: if is_allowed: return fn(endpoint, pid_value, **kwargs) else: abort(403) pid_type = get_pid_type_from_endpoint(endpoint) record = get_db_record(pid_type, pid_value) is_allowed = has_update_permission(current_user, record) session[cache_key] = is_allowed if is_allowed: return fn(endpoint, pid_value, **kwargs) else: abort(403)
def decorator(endpoint, pid_value, **kwargs): cache_key = 'editor-permission-{0}-{1}'.format( endpoint, pid_value ) is_allowed = session.get(cache_key) if is_allowed is not None: if is_allowed: return fn(endpoint, pid_value, **kwargs) else: abort(403) pid_type = get_pid_type_from_endpoint(endpoint) record = get_db_record(pid_type, pid_value) is_allowed = has_update_permission(current_user, record) session[cache_key] = is_allowed if is_allowed: return fn(endpoint, pid_value, **kwargs) else: abort(403)
def admin_tools(self): tools = [] if has_update_permission(current_user, self): tools.append('editor') return tools
def admin_tools(self): tools = [] if has_update_permission(current_user, self): tools.append('editor') return tools