Skip to content

Role Hierarchy not working #683

Closed
@davidruisinger

Description

@davidruisinger

I just did some dirty tests where I have a Cloud Function that initially does following:

  1. Creates a superuser
  2. Creates superuser role that can only be modified by the superuser
  3. Adds the superuser to the superuser role
  4. Creates an admin role that can only be modified by the superuser role
  5. Adds the superuser role to the admin role (superusers have the same rights as admins)
  6. Creates a customer role that can only be modified by the superuser role
  7. Adds the admin role to the customer role (admins have the same rights as customers)

(For testing purposes I have all this wrapped into this ugly spaghetti code

I also have a Class of Product and a beforeSave Hook that adds
setPublicReadAccess(true);
and
productACL.setRoleWriteAccess("admin", true);
to each product that is saved.

In my DB it seems that everything is setup properly:
Product:

{
  "_id": "6w74MRh8Kr",
  "_rperm": [
    "*"
  ],
  "_wperm": [
    "role:admin"
  ],
  ...
}

_User

{
  "_id": "GtYEf8IUE2",
  ...
}

Role

{
  "_id": "ipvDGI3CaF",
  ...
  "name": "admin",
  ...
}

and

{
  "_id": "9XUOMFg9eC",
  ...
  "name": "superuser",
  ...
}

_Join:roles:_Role

{
  "relatedId": "9XUOMFg9eC",
  "owningId": "ipvDGI3CaF"
}

_Join:users:_Role

{
  "relatedId": "GtYEf8IUE2",
  "owningId": "9XUOMFg9eC"
}

When I now login as this superuser, I can't update a Product even though the superuser role is a child of admin and should have ALL the admin rights which include write permission to Product.
(According to this doc https://parse.com/docs/js/guide#roles-role-hierarchy)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions