Skip to content

Commit

Permalink
Merge pull request #236 from CSCfi/CSCFC4EMSCR-617-Revert-bacl-to-MSC…
Browse files Browse the repository at this point in the history
…R-Copy

Cscfc4 emscr 617 revert bacl to mscr copy
  • Loading branch information
rquazi authored Dec 10, 2024
2 parents 33fad58 + dfb78f3 commit 34fd91f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions mscr-ui/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"finish-editing": "Finish editing",
"invalidate-crosswalk": "Invalidate crosswalk",
"invalidate-schema": "Invalidate schema",
"mscr-copy": "Covert to MSCR Format",
"mscr-copy": "Make a MSCR Copy",
"publish-crosswalk": "Publish crosswalk",
"publish-schema": "Publish schema",
"revision": "Add new revision",
Expand Down Expand Up @@ -91,7 +91,7 @@
"crosswalk-create": "Create Crosswalk",
"crosswalk-register": "Register Crosswalk",
"crosswalk-revision": "Register revision",
"mscr-copy": "Convert to MSCR Format",
"mscr-copy": "MSCR Copy",
"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": "Convert Schema to MSCR Format",
"schema-mscr-copy": "Make a MSCR copy",
"schema-register": "Register schema",
"schema-revision": "Register revision of schema"
},
Expand Down Expand Up @@ -278,7 +278,7 @@
"add-schema": "New schema added",
"add-schema-revision": "New schema version added",
"copy-crosswalk": "MSCR copy of crosswalk added",
"copy-schema": "Schema is converted to MSCR format",
"copy-schema": "MSCR copy of schema added",
"crosswalk-deleted": "Crosswalk was removed",
"crosswalk-deprecated": "Crosswalk deprecated",
"crosswalk-invalidated": "Crosswalk invalidated",
Expand Down
6 changes: 5 additions & 1 deletion mscr-ui/src/common/utils/has-permission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ export default function HasPermission({ action, owner }: hasPermissionProps) {
}

export function checkPermission({ user, action, owner }: checkPermissionProps) {
if (action == 'EDIT_CONTENT' || action == 'CREATE_CONTENT' || action == 'MAKE_MSCR_COPY') {
//making MSCR Copy allowed for all
if (action == 'MAKE_MSCR_COPY') {
return true;
}
if (action == 'EDIT_CONTENT' || action == 'CREATE_CONTENT') {
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', owner: schemaData?.owner});
const hasCopyPermission = HasPermission({ action: 'MAKE_MSCR_COPY'});
const router = useRouter(); // Force refresh the page
const isMscrCopyAvailable =
hasCopyPermission &&
Expand Down

0 comments on commit 34fd91f

Please sign in to comment.