Skip to content

feat: specify datastore keys permission#47

Merged
Sharmyn28 merged 17 commits intomasterfrom
feat/sharingPreference
Jul 16, 2020
Merged

feat: specify datastore keys permission#47
Sharmyn28 merged 17 commits intomasterfrom
feat/sharingPreference

Conversation

@Sharmyn28
Copy link
Collaborator

@Sharmyn28 Sharmyn28 commented Jun 15, 2020

This PR has:

  • Sharing POST for datastore keys when setup for the first time.
  • Check Authority, only if the user has ALL authority settings should be enabled to create, edit, or delete settings. If not all settings and buttons should be disabled, read-only.
  • If the user has ALL authority can create the namespace in datastore otherwise this option should be disabled
  • Only show program/data set with specific settings that are related to the current user

@Sharmyn28 Sharmyn28 requested a review from amcgee June 15, 2020 18:41
@Sharmyn28 Sharmyn28 added the waiting for approval Waiting for approval label Jun 22, 2020
Copy link
Contributor

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

This is a complex change, difficult to review, but I made a few suggestions after looking at the code. So long as this is well-tested for proper functionality this should be OK

<p className={disable ? warning.warning_color : undefined}>
{disable
? i18n.t(
"You don't have the authority to set up the android settings to this instance"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be "You are not authorized to configure Android settings, please contact a DHIS2 system administrator." (cc @cooper-joe to improve on my wording)

"You don't have the authority to set up the android settings to this instance"
)
: i18n.t(
'To set up the default settings and apply to all devices, click "Set default and save"'
Copy link
Contributor

Choose a reason for hiding this comment

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

@cooper-joe to confirm wording

}
})
}
return getAuthority().then(hasAuthority => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better not to n'est a bunch of callbacks here, this is very difficult to understand at a glance. I would recommend splitting it out into well-named helper functions

}
})
}
res.value.globalSettings.disableAll = !hasAuthority
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to treat this as constant, rather than mutating it - so you should create a copy below.

@Sharmyn28
Copy link
Collaborator Author

@amcgee I've just added some changes to fix it.

@Sharmyn28 Sharmyn28 requested a review from amcgee July 15, 2020 21:28
@amcgee
Copy link
Contributor

amcgee commented Jul 16, 2020

Milagros, you can merge this but please create an issue to address the wording change I suggested, as well as the mutation of res.value in apiLoadSettings

@Sharmyn28
Copy link
Collaborator Author

Milagros, you can merge this but please create an issue to address the wording change I suggested, as well as the mutation of res.value in apiLoadSettings

Thanks Austin, I've just created issues for these comments.

@Sharmyn28 Sharmyn28 merged commit 5e10af6 into master Jul 16, 2020
@Sharmyn28 Sharmyn28 deleted the feat/sharingPreference branch August 3, 2020 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for approval Waiting for approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants