{"record":{"id":"ce61d8bf626e600e","repo":"halo-dev/halo","slug":"user-permissions-not-set-in-permissionutils","errorCode":null,"errorMessage":"User permissions not set in PermissionUtils","messagePattern":"User permissions not set in PermissionUtils","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/packages/shared/src/utils/permission.ts","lineNumber":39,"sourceCode":"   *              Defaults to true.\n   * @returns true if the permission check passes, false otherwise\n   *\n   * @throws Error if user permissions are not set\n   *\n   * @example\n   * ```ts\n   * import { utils } from \"@halo-dev/ui-shared\"\n   *\n   * // Check if user has any of the permissions\n   * utils.permission.has(['core:posts:manage'], true);\n   *\n   * // Check if user has all of the permissions\n   * utils.permission.has(['core:posts:view', 'core:attachments:view'], false);\n   * ```\n   */\n  has(permissions: Array<string>, any: boolean = true): boolean {\n    if (!this.userPermissions) {\n      throw new Error(\"User permissions not set in PermissionUtils\");\n    }\n\n    // Super user with wildcard permission has all permissions\n    if (this.userPermissions.includes(\"*\")) {\n      return true;\n    }\n\n    // If no permissions are required, access is granted\n    if (!permissions.length) {\n      return true;\n    }\n\n    // If user has no permissions, access is denied\n    if (!this.userPermissions.length) {\n      return false;\n    }\n\n    if (any) {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/ui/packages/shared/src/utils/permission.ts#L21-L57","documentation":"Thrown during install()/upgrade() when every named dependency exists but at least one is at a version that fails the declared version constraint. It is PluginDependencyException.WrongVersionsException (ServerWebInputException, HTTP 400, problem type https://halo.run/probs/plugin-dependencies-with-wrong-versions); the body's `versions` field is a List of pf4j WrongDependencyVersion describing each mismatch.","triggerScenarios":"install()/upgrade() with a plugin whose pluginDependencies specifies a version constraint (e.g. \">=2.0.0\") that the currently installed dependency version does not satisfy.","commonSituations":"Requiring a newer minor of a dependency than is deployed; downgrading a dependency below a plugin's stated floor; mixing plugins built against different dependency versions.","solutions":["Upgrade each offending dependency plugin to a version satisfying the constraint — see the expected versions in the body `versions` list.","Relax the version constraint in plugin.yaml to match the deployed dependency version (only if the plugin truly still works).","Reinstall the dependency at the exact version the plugin was built and tested against."],"exampleFix":"// before — too strict for installed dependency\nspec:\n  pluginDependencies:\n    plugin-comment: \">=2.0.0\"\n// after — match the deployed 1.x line\nspec:\n  pluginDependencies:\n    plugin-comment: \">=1.4.0\"","handlingStrategy":"validation","validationCode":"// Check each declared constraint against the resolved dependency version.\nMap<String, String> deps = candidate.getSpec().getPluginDependencies();\nfor (var entry : deps.entrySet()) {\n    PluginWrapper w = pluginManager.getPlugin(entry.getKey());\n    if (w != null && !VersionUtils.satisfiesRequires(\n            w.getDescriptor().getVersion(), entry.getValue())) {\n        // version mismatch — upgrade dependency or relax constraint before upload\n    }\n}","typeGuard":null,"tryCatchPattern":"pluginService.upgrade(name, path)\n    .onErrorResume(PluginDependencyException.WrongVersionsException.class, e -> {\n        var versions = e.getBody().getProperty(\"versions\");\n        return Mono.error(new BusinessException(\"Version mismatch: \" + versions));\n    })","preventionTips":["Pin dependency constraints to versions you actually test against.","When bumping a dependency, re-publish dependents with widened ranges.","Read the body `versions` list to see expected vs. actual in failures."],"tags":["plugin","dependencies","versioning","install","validation"],"backgroundTag":null,"analyzedSha":"d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8","analyzedAt":"2026-08-14T00:18:38.915Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}