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

How to set CLP? #891

sumihiro opened this Issue Mar 7, 2016 · 8 comments


None yet
7 participants

sumihiro commented Mar 7, 2016

I need to set class level permission to some classes.
I referenced #92, and cheked Schema.js and spec/Schema.spec.js.

I tried to get config and load schema. But I could not get config.

Parse.Cloud.define('restrict', function(req, res) {

  Parse.Config.get().then((config) => {
    return config.database.loadSchema()
  }).then((schema) => {
    return schema.setPermissions('Product', {
      'find': {}
  }).then((schema) => {
  }, (err) => {

I got ParseError { code: 105, message: 'config does not exist' } on Parse.Config.get().

How to get config and set CLP?


This comment has been minimized.


gfosco commented Mar 7, 2016

You can get the right config object with:

var Config = require('parse-server/lib/Config');
var config = new Config('your-app-id', '/parse'); // second param is your mount point.

This comment has been minimized.


flovilmart commented Mar 7, 2016

This config and globalConfig are so confusing :)


This comment has been minimized.

sumihiro commented Mar 7, 2016

@gfosco Thanks for your advice.
I got config correctly, and set permission successfully!

@sumihiro sumihiro closed this Mar 7, 2016


This comment has been minimized.

chderen commented Mar 15, 2016

How to set a Role permissions in CLP level?



This comment has been minimized.

aaronbkarp commented Mar 15, 2016

It would be extremely useful to have some official documentation/sample code on the recommended way to set CLPs. At the moment I can't get my migrated app to work because it relies heavily on CLPs that I don't know how to migrate.


This comment has been minimized.

bdevore17 commented Mar 28, 2016

Do CLP's migrate in general, or no?


This comment has been minimized.

chderen commented Mar 28, 2016

After search i found the answer how to implement CLP.
The CLP is implemented and can be set via rest api (with master key).
the relevant file in parse-server is Schema.js

example with Parse Js SDK:

        'schemas/' + className,
        {className: className, fields: fields, classLevelPermissions: classLevelPermissions}

the value of fields and classLevelPermissions should match the format you get by GET request:


example for CLP

"classLevelPermissions": {
        "find": {
          "FVPW0vrLEB": true
        "get": {
          "FVPW0vrLEB": true
        "create": {},
        "update": {},
        "delete": {
          "*": true
        "addField": {
          "role:isRulsMDfQ": true

i hope it's can helpful.


This comment has been minimized.


drew-gross commented Mar 28, 2016

The newest version of the Parse Dashboard also lets you set CLPs, as long as you are also on the latest version of Parse Server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment