-
Notifications
You must be signed in to change notification settings - Fork 2
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
Beamline policy rules #182
Conversation
RE failing lints. The suggested changes change the behaviour so I 'm not sure if I'm trying to work against the way OPA expects rules to be written by making them undefined when the input is not present. |
f6e433c
to
afc4380
Compare
48908c7
to
a241bbb
Compare
3420bc4
to
ae8b7d6
Compare
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.
LGTM. Though think I'll probably do a re-write using maps at some point
ae8b7d6
to
47c469f
Compare
* session.access: user can access session * session.named_user: user is a named member of the visit * session.matches_beamline: visit is on the given beamline * session.session_beamline: beamline for the given visit * proposal.access: user can access proposal * proposal.named_user: user is a named user on the proposal * admin.admin: user is super admin * admin.beamline_admin: user is admin for the given beamline Rules are only defined if the required fields are included in the input. `admin.beamline_admin` refers to the beamline passed as `input.beamline` not as the beamline for the session defined by `proposal`+`visit`. Previous function `session.beamline` has been renamed to `beamline_for` to distinguish it from the `session.beamline` rule. User is determined from token passed as `input.token`.
47c469f
to
6bbf22b
Compare
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.
LGTM
Setting as a draft for now as I'm sure there must be a better way of doing it. The aim was to make the rules only defined if the required fields are present in the input but still be present (but false) if the conditions weren't met. eg
input = {}
=>result = {}
input = {"user": "name"}
=>result = {"admin": true}
orresult = {"admin": false}
.Setting the default to
false
would probably be ok but means you could get misleading results, eg if you passuser
,proposal
andvisit
, gettingbeamline_admin = false
back suggests the user is not the admin for the beamline for the visit which may or may not be correct.