Repository navigation
fix: align admin features with license status and edition #8284
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,9 @@ const folderPermissions = computed(() => { | |
| }) | ||
| const isFolder = computed(() => Boolean(folderPermissions.value && (props.isFolder || props.isRootFolder || props.type.endsWith('_FOLDER')))) | ||
| const authorizationType = computed(() => (isFolder.value ? (folderPermissions.value?.target ?? props.type) : props.type)) | ||
| const permissionOptions = computed(() => RESOURCE_PERMISSION_OPTIONS.filter(({ value }) => !auth.isCE || value !== RESOURCE_PERMISSION.ROLE)) | ||
| const permissionOptions = computed(() => | ||
| RESOURCE_PERMISSION_OPTIONS.filter(({ value }) => auth.isEE || auth.isPE || value !== RESOURCE_PERMISSION.ROLE), | ||
| ) | ||
| const editablePermissionOptions = computed(() => | ||
| permissionOptions.value.filter(({ value }) => !props.isRootFolder || value !== RESOURCE_PERMISSION.NOT_AUTH), | ||
| ) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The diff is syntactically valid; the trailing comma is fine with Prettier/TS. The main concern is a semantic behavior change: // Before
!auth.isCE || value !== ROLE
// Keeps ROLE for every non-CE case
// After
auth.isEE || auth.isPE || value !== ROLE
// Keeps ROLE only when isEE or isPE is truePotential issues
Suggested optimizationIf the intent is “ROLE is only available in EE/PE”: const canUseRolePermission = computed(() => auth.isEE || auth.isPE)
const permissionOptions = computed(() =>
RESOURCE_PERMISSION_OPTIONS.filter(
({ value }) => canUseRolePermission.value || value !== RESOURCE_PERMISSION.ROLE,
),
)If CE can coexist with EE/PE flags, use: const canUseRolePermission = computed(
() => !auth.isCE && (auth.isEE || auth.isPE),
)Minor adjacent concern
props.type.endsWith('_FOLDER')If const isFolder = computed(() =>
Boolean(
folderPermissions.value &&
(props.isFolder ||
props.isRootFolder ||
props.type?.endsWith('_FOLDER')),
),
)RecommendationConfirm the intended rule for |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ function toUrl(url?: string) { | |
| </span> | ||
|
|
||
| <!-- 社区版访问升级价格页 --> | ||
| <el-button v-if="!preview && auth.isCE" class="bg-primary-gradient" round @click="toUrl('https://maxkb.cn/price')"> | ||
| <el-button v-if="!preview && (auth.isCE || auth.isExpire)" class="bg-primary-gradient" round @click="toUrl('https://maxkb.cn/price')"> | ||
| <MkIcon name="icon_launch_outlined" /> | ||
| <span>{{ t('layout.upgrade') }}</span> | ||
| </el-button> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's my review of the diff: Summary of ChangeThe condition for displaying the "Upgrade" button was broadened from Potential Issues
Minor Optimization Suggestions
No functional bugs jump out, but the main thing to validate with product is whether expired non-CE users should be sent to the general pricing page and whether the "Upgrade" copy is appropriate for them. |
||
|
|
||
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.
The main concern is semantic equivalence, not syntax.
Potential issue
Original condition:
means: hide
ROLEonly when the edition is CE.Changed condition:
means: show
ROLEonly when the edition is EE or PE.These are equivalent only if:
EEorPE.isCE,isEE, andisPEare mutually exclusive.If auth flags are still loading/unknown, or if a new edition is introduced,
ROLEmay be hidden incorrectly. Conversely, ifisEEorisPEis accidentally true for a CE environment,ROLEwill be shown when the original code would hide it.Recommendation
Prefer expressing the capability directly instead of duplicating edition checks:
Or, if the intended rule is still “ROLE is unavailable only in CE”, keep the original logic:
Minor notes
filter().map()pattern is fine and readable.map()creates new objects on every auth-flag change, but that is usually acceptable for a small static options list.auth.isEEandauth.isPEare typed and guaranteed to exist. If they can beundefined, the boolean result is still safe, but explicit typing would be clearer.labelandvalue, themap()will drop them.Overall: the syntax is valid, but the changed logic is only safe if the edition flags are guaranteed to be mutually exclusive and exhaustive.