Repository navigation
feat: application publish permission #7728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
Issues / Irregularities
applicationIddependency risk –applicationWorkflowPermissionreferencesapplicationIdfrom the outer scope. Make sure it's declared before this function in<script setup>order, otherwise you'll get a temporal dead zone (ReferenceError) at init. Also consider passing it explicitly as a parameter for clarity/testability:Function called in template – re-evaluated on every render. Since permissions rarely change reactively (and
perm.application.system[method]()looks like a non-reactive call), wrap it in acomputed:Then use
v-if="canPublish".Inconsistent meaning of the API –
perm.application.system[method]()is called as a function, whileperm.application.workspace[method](applicationId)takes an argument. Verify both are actually functions (the type is only a string union; TS can't check these dynamic accesses). Ifpermhas typed methods, prefer direct calls:perm.application.system.publish()— safer and no string indexing.Import style inconsistency – elsewhere imports drop the
.tsextension ('@/utils/resource-context.ts'also has it, but'./navigation'doesn't). Standardize — typically omit extensions for module resolution consistency and bundler compatibility.Redundant
Boolean()– if the permission functions already return booleans,Boolean(...)wrapping is unnecessary noise. If they may return undefined/truthy values, the cast is fine — but note it explicitly in the permission module's typing instead.Optimization Suggestions
v-ifvs. disabling with:disabled+ tooltip ("no permission"). Hiding is cleaner security-wise, but confirm designers intend hidden (some teams prefer disabled-with-reason).ApplicationWorkflowPermissionMethodis verbose; something liketype WorkflowAction = 'publish'is clearer.useApplicationWorkflowPermission(applicationId)returning{ canPublish, canDelete, ... }, to avoid repeating helper calls in the template.Overall the change is functionally sound; the main real risks are #1 (declaration order) and #3 (unverified dynamic method existence).