isAdminOrSelf() — supabase Function Reference
Architecture documentation for the isAdminOrSelf() function in isAdminOrSelf.ts from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/cms/src/access/isAdminOrSelf.ts lines 3–21
export const isAdminOrSelf: Access = ({ req: { user } }) => {
// Need to be logged in
if (user) {
// If user has role of 'admin'
if (user.roles?.includes('admin')) {
return true
}
// If any other type of user, only provide access to themselves
return {
id: {
equals: user.id,
},
}
}
// Reject everyone else
return false
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free