#Write permission doesn't work with document security on

16 messages · Page 1 of 1 (latest)

distant mulch
#

As you can see, I have granted write permission to user 2 on this document, however the checkboxes on the permissions sections are all empty. I am on appwrite version 1.5.7

#

Write permission doesn't work with document security on

#

Update: actually this seems not be a visual bug. I won't be able to perform either update or delete with write permission on.

hidden adder
#

how did you grant "write"?

distant mulch
#

by the way...granting write permission in collection level works

hidden adder
hidden adder
#

and the result:

distant mulch
hidden adder
distant mulch
# hidden adder Node sdk in the browser? Also, what exactly is your code?

Sorry I didn't make it clear, it's on node.js environment. The package I use is node-appwrite 12.0.0. I had an initialization script to set up default users, workshopOffer is nested in user->workshop->workshopOffer. The code is as below. By the way I have already changed Permission.write() to a combination of Permission.update() and Permission.delete(). I am not sure if this bug persists cuz it didn't happen at later times.
`
let anyReadPermissions = [Permission.read(Role.any())]; // all users can read this collection
// permission.write doesn't work on document level, grant one by one
let userWritePermissions = (userID) => {
return [
Permission.write(Role.user(userID))
]
}

databases.createDocument(
...collectionUser,
"2",
{
userID: "2",
name: "xxx",
type: "organization",
// create document in inventory
userInventory: {
grain: 100,
$permissions: anyReadPermissions,
},
// create document in money
userMoney: {
gold: 1000,
coin: 10000,
$permissions: anyReadPermissions,
},
company: {
name: "Han State-owned",
$permissions: [Permission.update(Role.user("2"))],
},
workshop: [
{
name: "xxx",
type: "grain",
level: 5,
city: "1",
workshopOffer: [{ ecoSkill: 1, currency: "xxx", salary: 1, $permissions: userWritePermissions("2") }],
},
]
},
anyReadPermissions
),`