yetitwo
09/13/2023, 8:58 PMuser:* to say "all users can read this" or user:<id> to say "a specific user can read this"fm0
09/13/2023, 9:02 PMrelation reader: user | user:*
is the user without an id supposed to represent an anonymous user? I explicitly want it defined as an anonymous user as there will be read only boardsfm0
09/13/2023, 9:18 PMrelation reader: user | user:* | anonymous_user:*
board:whiteboard-4444#reader@user:222
board:whiteboard-4444#reader@user:*
board:whiteboard-4444#reader@anonymous_user:*
all seemed to work which I guess makes sense since if I only wanted to grant a certain user like board:whiteboard-4444#reader@anonymous_user:12
I would need to change the relation to
relation reader: user | user:* | anonymous_user | anonymous_user:*
This is very coolJoey
09/13/2023, 10:02 PMvroldanbet
09/14/2023, 11:17 AMfm0
09/14/2023, 12:17 PMJoey
09/14/2023, 1:21 PMfm0
09/14/2023, 1:22 PMfm0
09/14/2023, 1:23 PMJoey
09/14/2023, 1:24 PMuser, yes, you'll need to write user:*Joey
09/14/2023, 1:25 PMuser:anonymous or a defined-nameJoey
09/14/2023, 1:25 PMfm0
09/14/2023, 1:26 PMfm0
09/14/2023, 1:27 PMfm0
09/20/2023, 10:03 PMdefinition branchboard/board {
relation writer: branchboard/user
relation reader: branchboard/user | branchboard/user:*
permission edit = writer
permission view = reader + edit
}
definition branchboard/user {}
`
I am guessing if a user is being added to a board here, then both of the relationships should be added to accordingly. My write relationship code seems to only add in the board definition only and no idea why
https://cdn.discordapp.com/attachments/1151623073167056937/1154175905439154237/image.png▾
fm0
09/20/2023, 10:03 PMtypescript
const lol = v1.WriteRelationshipsRequest.create({
"updates": [
v1.RelationshipUpdate.create({
relationship: v1.Relationship.create({
resource: v1.ObjectReference.create({
objectType: 'branchboard/board',
objectId: board_id,
}),
relation: 'writer',
subject: v1.SubjectReference.create({
object: v1.ObjectReference.create({
objectType: 'branchboard/user',
objectId: user_id,
}),
}),
}),
operation: v1.RelationshipUpdate_Operation.TOUCH,
}),
],
})Joey
09/20/2023, 10:04 PMJoey
09/20/2023, 10:05 PMfm0
09/20/2023, 10:06 PMhttps://cdn.discordapp.com/attachments/1151623073167056937/1154176671679795320/image.png▾
fm0
09/20/2023, 10:06 PMfm0
09/20/2023, 10:06 PMfm0
09/20/2023, 10:06 PMJoey
09/20/2023, 10:06 PMJoey
09/20/2023, 10:06 PMJoey
09/20/2023, 10:06 PMJoey
09/20/2023, 10:07 PMfm0
09/20/2023, 10:07 PMJoey
09/20/2023, 10:07 PMfm0
09/20/2023, 10:08 PMfm0
09/20/2023, 10:08 PMJoey
09/20/2023, 10:08 PMfm0
09/20/2023, 10:08 PMJoey
09/20/2023, 10:08 PMfm0
09/20/2023, 10:09 PMJoey
09/20/2023, 10:11 PMfm0
09/22/2023, 3:04 PMtsx
const removeUserPermissionToBoard = async (board_id: string, user_id: string, permission: 'writer' | 'reader') => {
const remove_user_write_access_to_board = v1.DeleteRelationshipsRequest.create({
relationshipFilter: v1.RelationshipFilter.create({
resourceType: "branchboard/board",
optionalResourceId: board_id,
optionalRelation: permission,
optionalSubjectFilter: v1.SubjectFilter.create({
subjectType: 'user',
optionalSubjectId: user_id
})
})
})}
;
I keep getting Error: 3 INVALID_ARGUMENT: the length of the unpacked is not equal to the provided input
code: 3,
details: 'the length of the unpacked is not equal to the provided input',
metadata: Metadata {
internalRepr: Map(2) {
'io.spicedb.respmeta.dispatchedoperationscount' => [Array],
'io.spicedb.respmeta.cachedoperationscount' => [Array]
},
options: {}
}fm0
09/22/2023, 3:06 PMfm0
09/22/2023, 3:07 PMfm0
09/22/2023, 3:09 PMuser to branchboard/uservroldanbet
09/25/2023, 10:45 AMvroldanbet
09/25/2023, 10:45 AM