Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Cannot update field even when allowed

My schema

type Group
  @model
  @auth(
    rules: [
      { allow: private, operations: [create, read] }
      {
        allow: owner
        ownerField: "adminIds"
        operations: [create, read, update]
      }
      { allow: owner, ownerField: "creatorId" }
      {
        allow: groups
        groups: ["AdminRoot"]
        operations: [create, read, update, delete]
      }
    ]
  ) {
  id: ID!
  userIds: [ID]!
    @auth(
      rules: [
        { allow: private, operations: [create, read, update] }
        { allow: owner, ownerField: "creatorId" }
      ]
    )
}

My problem is, whenever i try to update my field userIds as an logged-in user, i get the error Unauthorized on [id]

Why am i not able to update this userIds field?

My code:

let group = await DataStore.save(Group.copyOf(this.group, updated => {
  let i = updated.userIds.indexOf(this.userData.username)

  if (i === -1) return
  updated.userIds.splice(i, 1)

}))
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!