Skip to content
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

152 create a permission group for users #154

Merged
merged 6 commits into from
Feb 14, 2023

Conversation

gerrycampion
Copy link
Collaborator

See the connected Issue for details and acceptance criteria.

To test, you will need to run the static webapp locally.
To simulate the prod env (restricted write access), you will need to add this env var to local.setting.json:

"CORE_AUTHOR_GROUP": "731986ea-faa8-4656-b445-414c1aa1a737"

To simulate the training env (all users have write access), do not add the env var.

When you login to the local SWA, it will request User ID and User's claims.
For write permissions, one of the two will need to be true:

[
  {
    "typ": "name",
    "val": "Gerry Campion"
  },
  {
    "typ": "extension_CompanyName",
    "val": "CDISC"
  }
]

If a user does not have write permissions, they should only be able to view/test rules. If they have write permissions, they should be able to do everything else, like modify, save, publish.

I've created a new related issue for securing the API: #153
Note that this issue has always existed and is not newly introduced by this update.

@gerrycampion gerrycampion linked an issue Feb 8, 2023 that may be closed by this pull request
@gerrycampion gerrycampion requested a review from nhaydel February 8, 2023 16:29
@github-actions
Copy link

github-actions bot commented Feb 8, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://icy-flower-095494b10-154.centralus.azurestaticapps.net

@@ -76,10 +76,9 @@ const AppContextProvider: React.FC = ({

const isRuleModifiable = useCallback(
() =>
!isRuleSelected() ||
(user && creator && user.id === creator.id) ||
(user && user.permissions) ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that a user is not in the group? And if so can they still edit rules?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user is not in the group, user.write_allowed is false.
Users with a cdiscid who are not in the group will be able to view but not edit rules, unless:

  • they are in CDISC company,
  • CORE_AUTHOR_GROUP is not specified for the env (for training env)

@@ -2,4 +2,5 @@ export interface IUser {
id: string;
name?: string;
company?: string;
permissions?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a boolean, should this name be more descriptive like "write_allowed"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://icy-flower-095494b10-154.centralus.azurestaticapps.net

@gerrycampion gerrycampion requested a review from nhaydel February 9, 2023 20:08
@gerrycampion gerrycampion merged commit 1879dfc into main Feb 14, 2023
@gerrycampion gerrycampion deleted the 152-create-a-permission-group-for-users branch February 14, 2023 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a permission group for users
2 participants