-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add rake task to assign access permissions for an organisation #2422
Conversation
0884ceb
to
8e71281
Compare
Four tasks are added that allow us to: - Assign and remove permissions on a case by case basis for specific artefacts - Remove all permission flags from an artefact, essentially resetting it to open permission - Assign an org permission to a group of artefacts from a CSV file containing rows of URLs There is no easy way to find the OrgID from an org name so OrgID must be provided by us when using it in the rake tasks.
8e71281
to
d1e2825
Compare
caddfeb
to
b21951e
Compare
…rrecting save_as_task! syntax
b21951e
to
24337a4
Compare
3f1505e
to
d9be641
Compare
2bd86e8
to
df8c83c
Compare
- Logging allows us to gather a list of documents that cannot be found - Failure to find is typically because the path/slug has changed.
df8c83c
to
26a3320
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.
A few minor comments.
if document.nil? | ||
message = "Document ID #{args[:document_content_id]} not found, no permissions changed." | ||
elsif document.latest_edition.owning_org_content_ids.include?(args[:org_content_id]) | ||
message = "Organisation already has permission to access the document with ID - #{document.id}" |
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.
Is it worth capturing the org ID in the various log messages?
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.
Great idea! I have added this to the start of the log file - see line 29
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.
Since this rake task can be called independently of the bulk one, I think it might still be a good idea to include the org ID in the log messages here.
e56afad
to
9e6bdb8
Compare
Now working on Integration. |
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.
One minor comment.
if document.nil? | ||
message = "Document ID #{args[:document_content_id]} not found, no permissions changed." | ||
elsif document.latest_edition.owning_org_content_ids.include?(args[:org_content_id]) | ||
message = "Organisation already has permission to access the document with ID - #{document.id}" |
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.
Since this rake task can be called independently of the bulk one, I think it might still be a good idea to include the org ID in the log messages here.
9e6bdb8
to
37030c5
Compare
37030c5
to
06a376e
Compare
Two tasks are added that allow us to:
There is no easy way to find the OrgID from an org name so OrgID must be provided by us when using it in the rake tasks.
https://trello.com/c/60RkKgwP/478-rake-task-to-set-owning-org-for-hmrc-content-mainstream
Follow these steps if you are doing a Rails upgrade.