-
Notifications
You must be signed in to change notification settings - Fork 113
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
New: Separate create and view permissions for annotations #358
Conversation
Enables annotations to be shown in a view-only setting with the correct scopes Annotations permissions will be as follows: - can_annotate - whether a user can add any new annotations - can_view_annotations_all - whether a user can view all annotations - can_view_annotations_self - whether a user can view their own annotations (This is not yet supported as Preview is not aware of who the user previewing the file is in order to distinguish which annotations belong to the current user vs. other users)
@@ -162,7 +168,7 @@ class Annotator extends EventEmitter { | |||
*/ | |||
showModeAnnotateButton(currentMode) { | |||
const mode = this.modeButtons[currentMode]; | |||
if (!mode || !this.isModeAnnotatable(currentMode)) { | |||
if (!mode || !this.permissions.canAnnotate || !this.isModeAnnotatable(currentMode)) { |
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.
Ensures button to create point/draw annotations does not display
@@ -534,12 +540,20 @@ class Annotator extends EventEmitter { | |||
fetchAnnotations() { | |||
this.threads = {}; | |||
|
|||
// Do not load any pre-existing annotations if the user does not have | |||
// the correct permissions | |||
if (!this.permissions.canViewAllAnnotations || !this.permissions.canViewOwnAnnotations) { |
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.
Does not fetch any annotations if the user cannot view any/their own annotations
// Hide delete button on plain highlights if user doesn't have | ||
// permissions | ||
if (annotations[0].permissions && !annotations[0].permissions.can_delete) { | ||
if (!this.canAnnotate) { |
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.
Hides buttons in the plain highlight dialog if the user does not have can_annotate
permissions
Tests coming soon! |
Enables annotations to be shown in a view-only setting with the correct scopes
Annotations permissions will be as follows: