You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cartodb/doc/frontend/editor/js/backbone-with-organizations.md

1.8 KiB

This document contains some notes on how to work with backbone models related to organization

Changes

  • User model has an organization attribute. Each user is always inside an organization, so this will be always filled. When the organization contains only a user, the application behavior is the same than we currently have (CartoDB 2.0)

  • Visualization object contains a permission attribute (instance of cdb.admin.Permission)

How to use them

  • add read permissions to a table
canonical_visualization.permission.setPermission(user_model, 'r').save();
  • add read/write permissions to a table
canonical_visualization.permission.setPermission(user_model, 'rw').save();
  • how to know if the organization for the current user is single or multiuser
user.isInsideOrg()
user.isAdminOrg()
  • know what users have access to a visualization
vis.permission.acl.each(function(aclItem) {
    console.log("user " + aclItem.get('user').get('username') + " permission: " + aclItem.get('type'))
})
  • know the owner of a visualization
// owner is a cdb.admin.User instance
vis.permission.owner.get('username')