Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients aren't allowed to perform the create operation on the role collection. (Code: 119, Version: 1.12.0) #1671

Closed
hclviv opened this issue Apr 28, 2016 · 15 comments

Comments

@hclviv
Copy link

hclviv commented Apr 28, 2016

Hello Team,

I am struggling with an issue which is related with PFRole Parse SDK Ver 1.12.0.

I have a parse app running on Parse server with iOS SDK 1.7.5 on PRODUCTION and in that app we are creating role from iOS app directly using PFRole, which is working fine.

But after migrating my Parse cloud app to Amazon + Mango DB and changed the Client iOS SDK to 1.12.0, I am getting issue and unable to create the PFRole.

The same code was working properly with iOS SDK 1.7.5. Will you please help me out to fix this issue

@hramos
Copy link
Contributor

hramos commented Apr 28, 2016

Did you check your class level permissions?

@hclviv
Copy link
Author

hclviv commented Apr 28, 2016

Request you to please more explain about class level permission. What I need to change in schema

@hclviv
Copy link
Author

hclviv commented Apr 28, 2016

hi @hramos

here is my class level permission (From MongoDB )for the Role-

{
    "_id": "_Role",
    "_metadata": {
        "class_permissions": {
            "get": {
                "*": true
            },
            "find": {
                "*": true
            },
            "update": {
                "*": true
            },
            "create": {
                "*": true
            },
            "delete": {
                "*": true
            },
            "addField": {
                "*": true
            },
            "readUserFields": [],
            "writeUserFields": []
        }
    },
    "role": "string",
    "roles": "relation<_Role>",
    "users": "relation<_User>",
    "name": "string",
    "organizationId": "string"
}

And from my iOS application I am trying to add the role like below:

        PFACL *roleACL = [PFACL ACL];
        [roleACL setPublicReadAccess:YES];
        [roleACL setPublicWriteAccess:YES];

        PFRole *roleAdmin = [PFRole roleWithName:roleNameAdmin acl:roleACL];
        [roleAdmin.users addObject:currentUser];
        [roleAdmin setValue:@"admin" forKey:@"role"];
        [roleAdmin setValue:orgId forKey:@"organizationId"];

will you please guide me what I am doing wring at Class level Permission.

@hclviv
Copy link
Author

hclviv commented May 2, 2016

Hi @hramos

Any guess ??

@xissburg
Copy link

xissburg commented May 4, 2016

+1
I have the same problem here. I tried to find where this error message is coming from but I didn't find this string in parse-server or in the iOS SDK source code. Why does this error even exist? What's the reason behind not allowing us to query roles from the client app? This is a necessity in my application.

@xissburg
Copy link

xissburg commented May 4, 2016

Oh here it is https://github.com/ParsePlatform/parse-server/blob/d33dd68cc521e63be68a93ab1a00cfdb7a7d243d/src/rest.js#L118

What is the point of enforeRoleSecurity? I don't want to enforce role security.

@xissburg
Copy link

xissburg commented May 4, 2016

Oh wait I think I don't have the latest version... this was actually removed here dd7fad8#diff-62e69722264e5a578707565ff5fcf41c

@drorsun
Copy link

drorsun commented May 5, 2016

We have the same issue. Application gets:

Clients aren't allowed to perform the find operation on the installation collection. (Code: 119, Version: 1.12.0)

@xissburg
Copy link

xissburg commented May 5, 2016

@drorsun Update your parse-server version.

@drorsun
Copy link

drorsun commented May 5, 2016

@xissburg I am on version 2.2.7 which is the latest

@brianyyz
Copy link

brianyyz commented May 5, 2016

I am having the same issue as @drorsun and am also on v2.2.7.
PFInstallation.currentInstallation().fetchInBackgroundWithBlock {...... returns error code 119.

@xissburg
Copy link

xissburg commented May 5, 2016

Check what your have in enforeRoleSecurity at node_modules/parse-server/lib/rest.js

@brianyyz
Copy link

brianyyz commented May 5, 2016

@xissburg the function is:

// Disallowing access to the _Role collection except by master key
function enforceRoleSecurity(method, className, auth) {
if (className === '_Installation' && !auth.isMaster) {
if (method === 'delete' || method === 'find') {
var error = 'Clients aren't allowed to perform the ' + method + ' operation on the installation collection.';
throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, error);
}
}
}

@drorsun
Copy link

drorsun commented May 5, 2016

@xissburg I also have the same code as @brianyyz does

@hclviv
Copy link
Author

hclviv commented May 5, 2016

Guys,

I updated my Parse-Server version and also the latest iOS SDK.
I setup my installation locally and now everything is working fine the issue is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants