/**
  * Constructor
  *
  * @param ACLRoleSet $roleSet
  */
 public function __construct(ACLRoleSet $roleSet)
 {
     $this->roleSet = $roleSet;
     $roleSet->load_relationship('acl_roles');
     $roles = $roleSet->acl_roles->getBeans();
     foreach ($roles as $role) {
         $this->index[$role->id] = true;
     }
 }
 /**
  * Returns existing or new role set corresponding to the given set of roles
  *
  * @param ACLRole[] $roles
  * @return ACLRoleSet
  */
 protected function getRoleSetByRoles(array $roles)
 {
     $roleSet = ACLRoleSet::findByRoles($roles);
     if (!$roleSet) {
         $roleSet = ACLRoleSet::createFromRoles($roles);
     }
     return $roleSet;
 }