1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69:
<?php
namespace LeanCloud;
/**
* Role representation on LeanCloud
*
* A role represents a group of users in ACL, where a role can be
* assigned read/write permissions. If a role was granted write
* permission, then users belongs to this role will all inherit the
* write permission.
*
* All users of a role could be queried by `$role->getUsers()`, which
* is an instance of Relation, where users can be added or
* removed.
*
* Roles can belong to role as well, which can be got by
* `$role->getRoles()`, where roles can be added or removed.
*
* @see ACL, Relation
*/
class Role extends LeanObject {
/**
* Table name on LeanCloud
* @var string
*/
protected static $className = "_Role";
/**
* Set name of role
*
* The name can contain only alphanumeric characters, _, -, and
* space. It cannot be changed after being saved.
*
* @return Role
*/
public function setName($name) {
$this->set("name", $name);
return $this;
}
/**
* Get name of role
*
* @return string
*/
public function getName() {
return $this->get("name");
}
/**
* Get a relation of users that belongs to this role
*
* @return Relation
*/
public function getUsers() {
return $this->getRelation("users");
}
/**
* Get a relation of roles that belongs to this role
*
* @return Relation
*/
public function getRoles() {
return $this->getRelation("roles");
}
}