Return a list of available roles (keystone role-list)

    CLI Example:

    .. code-block:: bash

        salt '*' keystone.role_list
163175
def role_list(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    ret = {}
    for role in kstone.roles.list():
        ret[role.name] = dict((value, getattr(role, value)) for value in dir(role)
                              if not value.startswith('_') and
                              isinstance(getattr(role, value), (six.string_types, dict, bool)))
    return ret
478596
def which_roles_can(self, name):
        
        targetPermissionRecords = AuthPermission.objects(creator=self.client, name=name).first()
        return [{'role': group.role} for group in targetPermissionRecords.groups]
1006411
def get_role_types(self):
    
    resp = self._get_resource_root().get(self._path() + '/roleTypes')
    return resp[ApiList.LIST_KEY]
835926
def role_get(user):
    '''
    
    '''
    user_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.strip().strip().split(':')

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

            # skip other users
            if role[0] != user:
                continue

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

    return list(set(user_roles))
976331
def roles(self):
        
        guild = self.guild
        if guild is None:
            return []

        return [role for role in guild.roles if self._roles.has(role.id)]
987611
def get_roles(server_context, container_path=None):
    
    url = server_context.build_url(security_controller, 'getRoles.api', container_path=container_path)
    return server_context.make_request(url, None)
1322953
def get_role_arn(role_name, env, region):
    
    session = boto3.Session(profile_name=env, region_name=region)
    iam_client = session.client('iam')

    LOG.debug('Searching for %s.', role_name)

    role = iam_client.get_role(RoleName=role_name)
    role_arn = role['Role']['Arn']

    LOG.debug("Found role's %s ARN %s", role_name, role_arn)

    return role_arn
839619
def get_networks(self):
        
        networks = self.c_resources["networks"]
        result = []
        for net in networks:
            _c_network = net.get("_c_network")
            if _c_network is None:
                continue
            roles = utils.get_roles_as_list(net)
            result.append((roles, _c_network))
        return result
307553
def list_roles(self, service_id=None, limit=None, marker=None):
        
        uri = "OS-KSADM/roles"
        pagination_items = []
        if service_id is not None:
            pagination_items.append("serviceId=%s" % service_id)
        if limit is not None:
            pagination_items.append("limit=%s" % limit)
        if marker is not None:
            pagination_items.append("marker=%s" % marker)
        pagination = "&".join(pagination_items)
        if pagination:
            uri = "%s?%s" % (uri, pagination)
        resp, resp_body = self.method_get(uri)
        roles = resp_body.get("roles", [])
        return [Role(self, role) for role in roles]
978707
def list_role_policies(role_name, region=None, key=None, keyid=None,
                       profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        response = conn.list_role_policies(role_name)
        _list = response.list_role_policies_response.list_role_policies_result
        return _list.policy_names
    except boto.exception.BotoServerError as e:
        log.debug(e)
        return []
985574
def listRoles(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["listRoles"], *args, **kwargs)
461064
def availableRoles(self):
        '''
        
        '''
        if not hasattr(self.instructor,'instructorprivatelessondetails'):
            return []
        return [
            [x.id,x.name] for x in
            self.instructor.instructorprivatelessondetails.roles.all()
        ]
1368673
def get_user_roles(self):
        
        if self.is_anonymous_user():
            return []
        current_user = ploneapi.user.get_current()
        return ploneapi.user.get_roles(user=current_user)
470652
def get_default_role(request):
    
    global DEFAULT_ROLE
    default = getattr(settings, "OPENSTACK_KEYSTONE_DEFAULT_ROLE", None)
    if default and DEFAULT_ROLE is None:
        try:
            roles = keystoneclient(request, admin=True).roles.list()
        except Exception:
            roles = []
            exceptions.handle(request)
        for role in roles:
            if default in (role.id, role.name):
                DEFAULT_ROLE = role
                break
    return DEFAULT_ROLE
107273
def get_users_by_roles(roles=None):
    
    if not isinstance(roles, (tuple, list)):
        roles = [roles]
    mtool = get_tool("portal_membership")
    return mtool.searchForMembers(roles=roles)
527898
def get_role(role_id,**kwargs):
    
    try:
        role = db.DBSession.query(Role).filter(Role.id==role_id).one()
        return role
    except NoResultFound:
        raise HydraError("Role not found (role_id={})".format(role_id))
1373594
def get_role_keys(cls, unit_key):
        
        stack = Role.objects.filter(unit_id=unit_key).values_list('key', flatten=True)
        for unit_key in cls.objects.filter(parent_id=unit_key).values_list('key', flatten=True):
            stack.extend(cls.get_role_keys(unit_key))
        return stack