feat(permissions): add workspace.skills_import and workspace.skills_export permissions (#25921)
This commit is contained in:
7 files changed
+42
-8
No files matched your search
@@ -131,7 +131,7 @@ async def export_skills(
|
||||
):
|
||||
if user.role != 'admin' and not await has_permission(
|
||||
user.id,
|
||||
'workspace.skills',
|
||||
'workspace.skills_export',
|
||||
await Config.get('user.permissions'),
|
||||
db=db,
|
||||
):
|
||||
@@ -158,8 +158,13 @@ async def create_new_skill(
|
||||
user=Depends(get_verified_user),
|
||||
db: AsyncSession = Depends(get_async_session),
|
||||
):
|
||||
if user.role != 'admin' and not await has_permission(
|
||||
user.id, 'workspace.skills', await Config.get('user.permissions'), db=db
|
||||
if user.role != 'admin' and not (
|
||||
await has_permission(
|
||||
user.id, 'workspace.skills', await Config.get('user.permissions'), db=db
|
||||
)
|
||||
or await has_permission(
|
||||
user.id, 'workspace.skills_import', await Config.get('user.permissions'), db=db
|
||||
)
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
|
||||
@@ -179,6 +179,8 @@ class WorkspacePermissions(BaseModel):
|
||||
prompts_export: bool = False
|
||||
tools_import: bool = False
|
||||
tools_export: bool = False
|
||||
skills_import: bool = False
|
||||
skills_export: bool = False
|
||||
|
||||
|
||||
class SharingPermissions(BaseModel):
|
||||
|
||||
Reference in new issue
Block a user