{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/683","repository_url":"https://api.github.com/repos/ParsePlatform/parse-server","labels_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/683/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/683/comments","events_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/683/events","html_url":"https://github.com/ParsePlatform/parse-server/issues/683","id":136722523,"number":683,"title":"Role Hierarchy not working","user":{"login":"flavordaaave","id":5305150,"avatar_url":"https://avatars.githubusercontent.com/u/5305150?v=3","gravatar_id":"","url":"https://api.github.com/users/flavordaaave","html_url":"https://github.com/flavordaaave","followers_url":"https://api.github.com/users/flavordaaave/followers","following_url":"https://api.github.com/users/flavordaaave/following{/other_user}","gists_url":"https://api.github.com/users/flavordaaave/gists{/gist_id}","starred_url":"https://api.github.com/users/flavordaaave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavordaaave/subscriptions","organizations_url":"https://api.github.com/users/flavordaaave/orgs","repos_url":"https://api.github.com/users/flavordaaave/repos","events_url":"https://api.github.com/users/flavordaaave/events{/privacy}","received_events_url":"https://api.github.com/users/flavordaaave/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"flovilmart","id":364568,"avatar_url":"https://avatars.githubusercontent.com/u/364568?v=3","gravatar_id":"","url":"https://api.github.com/users/flovilmart","html_url":"https://github.com/flovilmart","followers_url":"https://api.github.com/users/flovilmart/followers","following_url":"https://api.github.com/users/flovilmart/following{/other_user}","gists_url":"https://api.github.com/users/flovilmart/gists{/gist_id}","starred_url":"https://api.github.com/users/flovilmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flovilmart/subscriptions","organizations_url":"https://api.github.com/users/flovilmart/orgs","repos_url":"https://api.github.com/users/flovilmart/repos","events_url":"https://api.github.com/users/flovilmart/events{/privacy}","received_events_url":"https://api.github.com/users/flovilmart/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2016-02-26T15:08:36Z","updated_at":"2016-03-08T16:04:04Z","closed_at":"2016-02-29T22:35:04Z","body":"I just did some dirty tests where I have a Cloud Function that initially does following:\r\n\r\n1) Creates a superuser\r\n2) Creates superuser role that can only be modified by the superuser\r\n3) Adds the superuser to the superuser role\r\n4) Creates an admin role that can only be modified by the superuser role\r\n5) Adds the superuser role to the admin role (superusers have the same rights as admins)\r\n6) Creates a customer role that can only be modified by the superuser role\r\n7) Adds the admin role to the customer role (admins have the same rights as customers)\r\n\r\n(For testing purposes I have all this wrapped into this ugly [spaghetti code](https://gist.github.com/flavordaaave/3b1b63e1a053647a0fc6)\r\n\r\nI also have a Class of Product and a beforeSave Hook that adds\r\n`setPublicReadAccess(true);`\r\nand\r\n`productACL.setRoleWriteAccess(\"admin\", true);`\r\nto each product that is saved.\r\n\r\nIn my DB it seems that everything is setup properly:\r\n**Product**:\r\n```\r\n{\r\n  \"_id\": \"6w74MRh8Kr\",\r\n  \"_rperm\": [\r\n    \"*\"\r\n  ],\r\n  \"_wperm\": [\r\n    \"role:admin\"\r\n  ],\r\n  ...\r\n}\r\n```\r\n\r\n**_User**\r\n```\r\n{\r\n  \"_id\": \"GtYEf8IUE2\",\r\n  ...\r\n}\r\n```\r\n\r\n**Role**\r\n```\r\n{\r\n  \"_id\": \"ipvDGI3CaF\",\r\n  ...\r\n  \"name\": \"admin\",\r\n  ...\r\n}\r\n```\r\nand\r\n```\r\n{\r\n  \"_id\": \"9XUOMFg9eC\",\r\n  ...\r\n  \"name\": \"superuser\",\r\n  ...\r\n}\r\n```\r\n\r\n**_Join:roles:_Role**\r\n```\r\n{\r\n  \"relatedId\": \"9XUOMFg9eC\",\r\n  \"owningId\": \"ipvDGI3CaF\"\r\n}\r\n```\r\n\r\n**_Join:users:_Role**\r\n```\r\n{\r\n  \"relatedId\": \"GtYEf8IUE2\",\r\n  \"owningId\": \"9XUOMFg9eC\"\r\n}\r\n```\r\n\r\nWhen 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.\r\n(According to this doc https://parse.com/docs/js/guide#roles-role-hierarchy)\r\n"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/comments/193840435","html_url":"https://github.com/ParsePlatform/parse-server/issues/683#issuecomment-193840435","issue_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/683","id":193840435,"user":{"login":"flavordaaave","id":5305150,"avatar_url":"https://avatars.githubusercontent.com/u/5305150?v=3","gravatar_id":"","url":"https://api.github.com/users/flavordaaave","html_url":"https://github.com/flavordaaave","followers_url":"https://api.github.com/users/flavordaaave/followers","following_url":"https://api.github.com/users/flavordaaave/following{/other_user}","gists_url":"https://api.github.com/users/flavordaaave/gists{/gist_id}","starred_url":"https://api.github.com/users/flavordaaave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavordaaave/subscriptions","organizations_url":"https://api.github.com/users/flavordaaave/orgs","repos_url":"https://api.github.com/users/flavordaaave/repos","events_url":"https://api.github.com/users/flavordaaave/events{/privacy}","received_events_url":"https://api.github.com/users/flavordaaave/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T16:04:04Z","updated_at":"2016-03-08T16:04:04Z","body":"@flovilmart THX again. I just tested with the latest master branch and everything is working now!!! :thumbsup: :thumbsup: :thumbsup:"}}