-
Notifications
You must be signed in to change notification settings - Fork 248
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
feat: Added datadoc and list access permissions for user groups #1533
feat: Added datadoc and list access permissions for user groups #1533
Conversation
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "querybook", | |||
"version": "3.38.0", | |||
"version": "3.38.1", |
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.
bump minor?
from enum import Enum | ||
|
||
|
||
class Permission(Enum): |
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.
name is a bit too general
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.
EntityPermission? probably more clear with a comment on where this is used
|
||
|
||
@with_session | ||
def assert_is_not_group(id, session=None): |
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.
name is a bit generic, can we rename id to board_editor_id
if user is None: | ||
api_assert(False, "USER_DNE", RESOURCE_NOT_FOUND_STATUS_CODE) |
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.
uid = sql.Column(sql.Integer, sql.ForeignKey("user.id", ondelete="CASCADE"))
this check is not needed? since sql constraints to prevent it
querybook/server/logic/board.py
Outdated
|
||
return [ | ||
BoardEditor( | ||
# [0] is id, [1] is uid, [2] is read, [3] is write |
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.
comment is not needed?
seems to be more ideal to write like this
for id, uid, read, write in editors
if (uid in editorsByUid || uid === board.owner_uid) { | ||
if ( | ||
uid === board.owner_uid || | ||
(uid in editorsByUid && editorsByUid[uid].id !== null) |
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.
!!editorsByUid[uid]?.id
seems easier to just check this
@@ -20,33 +22,40 @@ export function readWriteToPermission( | |||
read: boolean, | |||
write: boolean, | |||
isOwner: boolean, | |||
publicDoc: boolean | |||
publicDoc: boolean, |
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.
publicDoc isn't used? should we remove?
@@ -20,33 +22,40 @@ export function readWriteToPermission( | |||
read: boolean, | |||
write: boolean, | |||
isOwner: boolean, | |||
publicDoc: boolean | |||
publicDoc: boolean, | |||
id: number |
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.
instead of id field, it should be a boolean to indicate if its a permissionFromGroup
(dataDoc, editorsByUserId, viewerIds) => { | ||
(state: IStoreState) => state.user.myUserInfo.uid, | ||
(dataDoc, editorsByUserId, viewerIds, uid) => { | ||
const newEditorsByUserId = Object.fromEntries( |
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.
nonGroupEditorsByUserId
Co-authored-by: Ana <[email protected]>
bbe8c13
to
87284e3
Compare
This is the same PR of #1297 (author: @jij1949), with rebasing and adding some demo users.