Skip to content

Commit

Permalink
Modified Permission for converting to MSCR
Browse files Browse the repository at this point in the history
  • Loading branch information
rquazi committed Oct 22, 2024
1 parent b026dbb commit 8a910ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions mscr-ui/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"crosswalk-create": "Create Crosswalk",
"crosswalk-register": "Register Crosswalk",
"crosswalk-revision": "Register revision",
"mscr-copy": "Register MSCR Copy",
"mscr-copy": "Convert to MSCR Format",
"schema-register": "Register Schema",
"schema-revision": "Register revision"
},
Expand All @@ -109,7 +109,7 @@
"crosswalk-mscr-copy": "Register MSCR copy of crosswalk",
"crosswalk-register": "Register existing crosswalk",
"crosswalk-revision": "Register revision of crosswalk",
"schema-mscr-copy": "Register MSCR copy of schema",
"schema-mscr-copy": "Convert Schema to MSCR Format",
"schema-register": "Register schema",
"schema-revision": "Register revision of schema"
},
Expand Down Expand Up @@ -277,7 +277,7 @@
"add-schema": "New schema added",
"add-schema-revision": "New schema version added",
"copy-crosswalk": "MSCR copy of crosswalk added",
"copy-schema": "MSCR copy of schema added",
"copy-schema": "Schema is converted to MSCR format",
"crosswalk-deleted": "Crosswalk was removed",
"crosswalk-deprecated": "Crosswalk deprecated",
"crosswalk-invalidated": "Crosswalk invalidated",
Expand Down
4 changes: 1 addition & 3 deletions mscr-ui/src/common/utils/has-permission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export default function HasPermission({ action, owner }: hasPermissionProps) {
}

export function checkPermission({ user, action, owner }: checkPermissionProps) {
if (action == 'MAKE_MSCR_COPY') {
return true;
} else if (action == 'EDIT_CONTENT') {
if (action == 'EDIT_CONTENT'||'MAKE_MSCR_COPY') {
if (owner?.includes(user.id)) {
//user is the owner, Check for personal Contents
return true;
Expand Down
2 changes: 1 addition & 1 deletion mscr-ui/src/modules/schema-view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function SchemaView({ schemaId }: { schemaId: string }) {
isEditContentActive &&
hasEditPermission &&
schemaData?.format === Format.Mscr;
const hasCopyPermission = HasPermission({ action: 'MAKE_MSCR_COPY' });
const hasCopyPermission = HasPermission({ action: 'MAKE_MSCR_COPY', owner: schemaData?.owner});
const router = useRouter(); // Force refresh the page
const isMscrCopyAvailable =
hasCopyPermission &&
Expand Down

0 comments on commit 8a910ce

Please sign in to comment.