-
Notifications
You must be signed in to change notification settings - Fork 24
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
O3-3002: Queue Module - REST endpoints can be accessed without authentication. #73
Conversation
818cdb7
to
26cd748
Compare
26cd748
to
48ff6f2
Compare
api/src/main/resources/liquibase.xml
Outdated
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<sqlCheck expectedResult="0"> | ||
SELECT count(*) FROM role_privilege WHERE privilege='Get Visits'; |
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.
I would think the more appropriate check here, would be to execute this only if no one already has the "Get Queue Entries" privilege (which would imply it has already previously been assigned as desired). Then, this also allows you to get rid of the "AND NOT EXISTS..." clause from your insert statement below, right?
The same sort of logic would be applied to all of the changesets below. So:
- If any role already has privilege A, then mark as RAN
- Otherwise, assign privilege A to any role that already has privilege B.
api/src/main/resources/liquibase.xml
Outdated
</not> | ||
</preConditions> | ||
<comment>Add "Manage Queue Entries" privilege to the roles having "Edit Visits"</comment> | ||
<sql> | ||
INSERT INTO role_privilege (role, privilege) | ||
SELECT role, 'Manage Queue Entries' from role_privilege rp | ||
WHERE rp.privilege = 'Edit Visits' |
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.
If you are going to do this, I think you need to ensure you only insert the distict roles from both, so a single sql statement, something like:
INSERT INTO role_privilege (role, privilege)
SELECT distinct role, 'Manage Queue Entries' from role_privilege rp
WHERE rp.privilege in ('Add Visits', 'Edit Visits');
api/src/main/resources/liquibase.xml
Outdated
</not> | ||
</preConditions> | ||
<comment>Add "Manage Queue Rooms" privilege to the roles having "Edit Visits"</comment> | ||
<sql> |
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.
Same comment as above, you need to use something like:
INSERT INTO role_privilege (role, privilege)
SELECT distinct role, 'Manage Queue Rooms' from role_privilege rp
WHERE rp.privilege in ('Add Visits', 'Edit Visits');
d653c6c
to
746d920
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.
This looks ok to me now, thanks! Hopefully no further post-commit issues.
Unfortunately, after this changeset one of our CI servers (ci.pih-emr.org) is failing to start with this error:
|
So, bizarre @mseaton @IamMujuziMoses , on ci.pih-enr.org another privilege does indeed appear to have this same uuid:
... but this doesn't appear to be the case on at least on other of our CI servers that I checked. Do we know where this uuid came from? |
Ugh. So yeah, this is a duplicate uuid. It is also set here: |
Assumingly it wasn't created randomly, so I wonder if there are other duplicates? |
Issue I worked on
see https://issues.openmrs.org/browse/O3-3002
Checklist: I completed these to help reviewers :)
QueueService
,QueueEntryService
,QueueRoomService
andRoomProviderMapService
.PrivilegeConstants
class to contain all privilege names and their descriptions.