feat: add script template permission checks to usePermissions hook
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -71,5 +71,16 @@ export function usePermissions() {
|
||||
canManageCategories: hasMinimumRole(user, 'owner'),
|
||||
canManageGlobalCategories: effectiveRole === 'super_admin',
|
||||
canManageAccount: effectiveRole === 'super_admin' || effectiveRole === 'owner',
|
||||
|
||||
canManageScriptTemplate: (template: { created_by: string | null; team_id?: string | null }) => {
|
||||
if (!user) return false
|
||||
if (user.is_super_admin) return true
|
||||
if (user.account_role === 'owner') return true
|
||||
return template.created_by === user.id
|
||||
},
|
||||
|
||||
canShareScriptTemplate: effectiveRole === 'super_admin' || effectiveRole === 'owner',
|
||||
|
||||
canCreateScriptTemplate: hasMinimumRole(user, 'engineer'),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user