(Re)loads all roles and permissions into memory.
424871
@Override
    public void refresh() {
		try {
            _roles.clear();

			List<Permission> permissions = new ArrayList<Permission>();
			String name = null;
			for (Permission auth: _authority.loadRolesAndPermissions()) {
				if (name != null && !name.equals(auth.roleId)) {
					_logger.fine(name + " with " + permissions.size() + " authorizations");
					_roles.put(name, permissions.toArray(new Permission[permissions.size()]));
					permissions.clear();
				}
				name = auth.roleId;
				permissions.add(auth);
			}
			if (name != null) {
				_logger.fine(name + " with " + permissions.size() + " authorizations");
				_roles.put(name, permissions.toArray(new Permission[permissions.size()]));
			}

			_logger.info("Completed loading all roles & permissions");
		} catch (Exception x) {
			throw new ServiceException("***FailureInLoadingRoles", x);
		}
    }
1254643
def get_user_roles(self, user):
        """"""
        memberShipRecords = AuthMembership.objects(creator=self.client, user=user).only('groups')
        results = []
        for each in memberShipRecords:
            for group in each.groups:
                results.append({'role':group.role})
        return results
951698
def reconnect_all(self):
        
        for role in self.Instances.keys():
            for connection in self.Instances[role]:
                connection.reconnect()
1328737
protected function _loadPermissions()
    {
        if (empty($this->_permissions)) {
            $permissions = TableRegistry::get('Content.ContentTypePermissions')
                ->find()
                ->where(['content_type_id' => $this->get('id')])
                ->toArray();
            $this->_permissions = collection($permissions);
        }
    }
1050716
public function loadRoles()
    {
        if ($this->repository->hasAccess('role', 'read') !== true) {
            throw new UnauthorizedException('role', 'read');
        }

        $spiRoles = $this->userHandler->loadRoles();

        $roles = array();
        foreach ($spiRoles as $spiRole) {
            $roles[] = $this->roleDomainMapper->buildDomainRoleObject($spiRole);
        }

        return $roles;
    }
557902
def all
      @roles = Array.new
      @connection.deploys.all.each do |deploy|
        deploy.roles.each do |role|
          @roles << role
        end
      end
      @roles
    end
804547
def load_rules(self, force_reload=False, overwrite=True):
        """"""

        # double-checked locking
        if self.load_once and self._policy_loaded:
            return
        with self._load_lock:
            if self.load_once and self._policy_loaded:
                return

            reloaded, data = _cache.read_file(
                self.policy_file, force_reload=force_reload)
            self._policy_loaded = True
            if reloaded or not self.rules:
                rules = Rules.load_json(data, self.default_rule, self.raise_error)
                self._set_rules(rules, overwrite=overwrite)
                LOG.debug('Reload policy file: %s', self.policy_file)
303776
public function roleLoadPermissions($roles)
    {
        if (!$roles) {
            return false;
        }
        $multi = is_array($roles);
        if (!$multi) {
            $roles = [$roles];
        }
        $permissions_ids = [];

        foreach ($roles as $role) {
            if (!is_array($role->_permission_ids)) {
                $role->_permission_ids = explode(',', $role->_permission_ids);
            }
            $permissions_ids = array_merge($permissions_ids, $role->_permission_ids);
        }
        $perms = $this->permissionFetchById($permissions_ids);
        foreach ($perms as $perm) {
            foreach ($roles as $role) {
                if (in_array($perm->permission_id, $role->_permission_ids)) {
                    $role->addPermission($perm);
                    continue;
                }
            }
        }
        return true;
    }
186473
def persist_registered_roles!
      @roles.each do |name, description|
        Sipity::Role.find_or_create_by!(name: name).tap do |role|
          role.description = description
          role.save!
        end
      end
    end
35823
def get_roles():
    """"""
    roles = []
    for root, subfolders, files in os.walk('roles'):
        for filename in files:
            if filename.endswith(".json"):
                path = os.path.join(
                    root[len('roles'):], filename[:-len('.json')])
                roles.append(_get_role(path))
    return sorted(roles, key=lambda x: x['fullname'])
627943
public function afterConstruct()
    {
        if (! isset($this->attributes['permissions'])) {
            $this->permissions = $this->factory->create(RolePermission::class);
        }
    }
234971
def fullLoad(self):
        """"""
        self._parseDirectories(self.ntHeaders.optionalHeader.dataDirectory, self.PE_TYPE)
1104194
def add(self, roles):
        
        return self._client.post(
            url=self._client.get_full_url(
                self.get_path(
                    'single', realm=self._realm_name, id=self._user_id
                )
            ),
            data=json.dumps(roles, sort_keys=True)
        )
1273509
public static function bootLaratrustRoleTrait()
    {
        $flushCache = function ($role) {
            $role->flushCache();
        };

        // If the role doesn't use SoftDeletes.
        if (method_exists(static::class, 'restored')) {
            static::restored($flushCache);
        }

        static::deleted($flushCache);
        static::saved($flushCache);

        static::deleting(function ($role) {
            if (method_exists($role, 'bootSoftDeletes') && !$role->forceDeleting) {
                return;
            }

            $role->permissions()->sync([]);

            foreach (array_keys(Config::get('laratrust.user_models')) as $key) {
                $role->$key()->sync([]);
            }
        });
    }
664914
def clear_roles(user):
    """"""
    roles = get_user_roles(user)

    for role in roles:
        role.remove_role_from_user(user)

    return roles
24449
def user_roles(self):
        
        # We do here some lazy loading.
        if not self._user_roles:
            self._user_roles = UserRoleManager(self)
        return self._user_roles
93516
def initialize__(cls):
        
        [cls.new(level=r[0], name=r[1]) for r in cls.ROLES]