{"record":{"id":"81986e54aaf10f2c","repo":"alibaba/spring-ai-alibaba","slug":"permissiondenied","errorCode":"PermissionDenied","errorMessage":"You do not have permission for this operation.","messagePattern":"You do not have permission for this operation\\.","errorType":"error_code","errorClass":"BizException","httpStatus":403,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AccountServiceImpl.java","lineNumber":606,"sourceCode":"\t\t}\n\n\t\tAccount account = BeanCopierUtils.copy(entity, Account.class);\n\t\taccount.setPassword(null);\n\t\treturn account;\n\t}\n\n\t/**\n\t * Verifies admin permissions\n\t * @param accountId Account ID to check\n\t */\n\tprivate void checkAdminPermission(String accountId) {\n\t\tAccountEntity entity = getAccountById(accountId);\n\t\tif (entity == null) {\n\t\t\tthrow new BizException(ErrorCode.ACCOUNT_NOT_FOUND.toError());\n\t\t}\n\n\t\tif (AccountType.ADMIN != entity.getType()) {\n\t\t\tthrow new BizException(ErrorCode.PERMISSION_DENIED.toError());\n\t\t}\n\t}\n\n\t/**\n\t * create workspace for account\n\t * @param accountId account id\n\t * @return workspace id\n\t */\n\tprivate String createWorkspace(String accountId) {\n\t\tWorkspace workspace = new Workspace();\n\t\tworkspace.setAccountId(accountId);\n\t\tworkspace.setName(\"Default Workspace\");\n\t\tworkspace.setDescription(\"Default workspace\");\n\t\treturn workspaceService.createWorkspace(workspace);\n\t}\n\n}\n","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AccountServiceImpl.java#L588-L624","documentation":"checkAdminPermission in AccountServiceImpl throws BizException(PERMISSION_DENIED) when the account exists but its type is not AccountType.ADMIN. Called before admin-only operations (create/update/delete/list accounts).","triggerScenarios":"Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AccountServiceImpl.java:606 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Perform the operation with an account that has ADMIN type","Grant admin role via proper admin workflow","Hide/omit admin-only actions in the UI for non-admin users"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}