Get a specific role information
170999
def get(self, roleId):
        """"""
        role = db.Role.find_one(Role.role_id == roleId)

        if not role:
            return self.make_response('No such role found', HTTP.NOT_FOUND)

        return self.make_response({'role': role})
410981
def get_role(self, role):
        
        role = AuthGroup.objects(role=role, creator=self.client).first()
        return role
412745
function findRoles(identifiers) {
  return loadRoles()
  .then((roles) => {
    return _.filter(roles, (role) => { return identifiers.indexOf(role.name) !== -1; });
  });
}
292973
def list_roles():
    """"""
    for role in lib.get_roles():
        margin_left = lib.get_margin(len(role['fullname']))
        print("{0}{1}{2}".format(
            role['fullname'], margin_left,
            role.get('description', '(no description)')))
477967
function getRequiredRoleList (resourceType, resourceName, action, rbacIndex) {
  // What roles will allow this?
  const unrestricted = dottie.get(rbacIndex, '*.*.*') || []
  const unrestrictedInADomain = dottie.get(rbacIndex, `${resourceType}.*.*`) || []
  const anyActionOnASpecificResource = dottie.get(rbacIndex, `${resourceType}.${resourceName}.*`) || []
  const anyDomainResourceForASpecificAction = dottie.get(rbacIndex, `${resourceType}.*.${action}`) || []
  const specific = dottie.get(rbacIndex, `${resourceType}.${resourceName}.${action}`) || []

  return unrestricted.concat(
    unrestrictedInADomain,
    anyActionOnASpecificResource,
    anyDomainResourceForASpecificAction,
    specific
  )
}
822301
async def role(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["role"], *args, **kwargs)
221898
def get_roles(self):
        '''
        
        '''
        roles = {}
        paths = self.get_roles_paths()

        for path in paths:
            for entry in os.listdir(path):
                rolepath = os.path.join(path, entry)
                if os.path.isdir(rolepath):
                    roles[entry] = rolepath

        return roles
565871
public static function getRoleACL($role)
    {
        global $PPHP;
        $db = $PPHP['db'];

        $flat = $db->selectArray(
            "
            SELECT action, objectType, objectId
            FROM acl_roles
            WHERE role=?
            ",
            array($role)
        );
        return is_array($flat) ? $flat : array();
    }
713193
def role_search(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.search_roles(**kwargs)
745708
public function getRole() : ?string 
    {
        if ( ! $this->hasRole()) {
            $this->setRole($this->getDefaultRole());
        }
        return $this->role;
    }
1084158
def list_roles():
    
    click.echo(green('\nListing roles:'))
    click.echo(green('-' * 40))
    with get_app().app_context():
        roles = Role.query.all()
        if not roles:
            click.echo(red('No roles found'))
            return

        for index,role in enumerate(roles):
            click.echo('{}. {}: {}'.format(
                index + 1,
                yellow(role.handle),
                role.title
            ))

    click.echo()
1157943
def findRoleID(self, name):
        """"""
        for r in self:
            if r['name'].lower() == name.lower():
                return r['id']
            del r
        return None
1328527
def get_roles(self):
        
        if self.role.exist:
            # return explicitly selected role
            return [self.role]
        else:
            roles = []
            if self.role_query_code:
                #  use given "role_query_code"
                roles = RoleModel.objects.filter(**self.role_query_code)
            elif self.unit.exist:
                # get roles from selected unit or sub-units of it
                if self.recursive_units:
                    # this returns a list, we're converting it to a Role generator!
                    roles = (RoleModel.objects.get(k) for k in
                             UnitModel.get_role_keys(self.unit.key))
                else:
                    roles = RoleModel.objects.filter(unit=self.unit)
            elif self.get_roles_from:
                # get roles from selected predefined "get_roles_from" method
                return ROLE_GETTER_METHODS[self.get_roles_from](RoleModel)

        if self.abstract_role.exist and roles:
            # apply abstract_role filtering on roles we got
            if isinstance(roles, (list, types.GeneratorType)):
                roles = [a for a in roles if a.abstract_role.key == self.abstract_role.key]
            else:
                roles = roles.filter(abstract_role=self.abstract_role)
        else:
            roles = RoleModel.objects.filter(abstract_role=self.abstract_role)

        return roles
868496
def role_list():
    '''
    
    '''
    roles = {}

    ## read user_attr file (user:qualifier:res1:res2:attr)
    with salt.utils.files.fopen('/etc/user_attr', 'r') as user_attr:
        for role in user_attr:
            role = salt.utils.stringutils.to_unicode(role)
            role = role.split(':')

            # skip comments and non complaint lines
            if len(role) != 5:
                continue

            # parse attr
            attrs = {}
            for attr in role[4].split(';'):
                attr_key, attr_val = attr.split('=')
                if attr_key in ['auths', 'profiles', 'roles']:
                    attrs[attr_key] = attr_val.split(',')
                else:
                    attrs[attr_key] = attr_val
            role[4] = attrs

            # add role info to dict
            if 'type' in role[4] and role[4]['type'] == 'role':
                del role[4]['type']
                roles[role[0]] = role[4]

    return roles
241205
def get_role(self, id=None, name=None):
        
        log.info("Picking role: %s (%s)" % (name, id))
        return self.roles[id or name]
879471
def get(self, user_id):
        """"""
        user = db.User.find_one(User.user_id == user_id)
        roles = db.Role.all()

        if not user:
            return self.make_response('Unable to find the user requested, might have been removed', HTTP.NOT_FOUND)

        return self.make_response({
            'user': user.to_json(),
            'roles': roles
        }, HTTP.OK)
364998
def role?(role_sym)
      role_sym = [role_sym] unless role_sym.is_a?(Array)

      roles.map { |r| r.name.underscore.to_sym }.any? { |user_role| role_sym.include?(user_role) }
    end