Return the indy-sdk role of least privilege for an anchor (class) in building
        its cryptonym for the trust anchor to send to the ledger.

        :return: role of least privilege by anchor class
430444
def least_role() -> Role:
        

        LOGGER.debug('BaseAnchor.least_role >>>')

        rv = Role.TRUST_ANCHOR

        LOGGER.debug('BaseAnchor.least_role <<< %s', rv)
        return rv
675596
private static boolean anchorIsTarget(TrustAnchor anchor,
                                          CertSelector sel)
    {
        X509Certificate anchorCert = anchor.getTrustedCert();
        if (anchorCert != null) {
            return sel.match(anchorCert);
        }
        return false;
    }
6736
def get_caller_identity_arn(self):
        
        assumed_role = self.boto_session.client('sts').get_caller_identity()['Arn']

        if 'AmazonSageMaker-ExecutionRole' in assumed_role:
            role = re.sub(r'^(.+)sts::(\d+):assumed-role/(.+?)/.*$', r'\1iam::\2:role/service-role/\3', assumed_role)
            return role

        role = re.sub(r'^(.+)sts::(\d+):assumed-role/(.+?)/.*$', r'\1iam::\2:role/\3', assumed_role)

        # Call IAM to get the role's path
        role_name = role[role.rfind('/') + 1:]
        try:
            role = self.boto_session.client('iam').get_role(RoleName=role_name)['Role']['Arn']
        except ClientError:
            LOGGER.warning("Couldn't call 'get_role' to get Role ARN from role name {} to get Role path."
                           .format(role_name))

        return role
464275
def get_privilege_information():
	
	# first call with zero length to determine what size buffer we need

	return_length = wintypes.DWORD()
	params = [
		get_process_token(),
		privilege.TOKEN_INFORMATION_CLASS.TokenPrivileges,
		None,
		0,
		return_length,
	]

	res = privilege.GetTokenInformation(*params)

	# assume we now have the necessary length in return_length

	buffer = ctypes.create_string_buffer(return_length.value)
	params[2] = buffer
	params[3] = return_length.value

	res = privilege.GetTokenInformation(*params)
	assert res > 0, "Error in second GetTokenInformation (%d)" % res

	privileges = ctypes.cast(
		buffer, ctypes.POINTER(privilege.TOKEN_PRIVILEGES)).contents
	return privileges
556523
def indexable_role(principal):
    
    principal = unwrap(principal)

    if hasattr(principal, "is_anonymous") and principal.is_anonymous:
        # transform anonymous user to anonymous role
        principal = Anonymous

    if isinstance(principal, Role):
        return f"role:{principal.name}"
    elif isinstance(principal, User):
        fmt = "user:{:d}"
    elif isinstance(principal, Group):
        fmt = "group:{:d}"
    else:
        raise ValueError(repr(principal))

    return fmt.format(principal.id)
632713
def roles_accepted(*accepted_rolenames):
    
    def decorator(method):
        @functools.wraps(method)
        def wrapper(*args, **kwargs):
            role_set = set([str(n) for n in accepted_rolenames])
            _verify_and_add_jwt()
            try:
                MissingRoleError.require_condition(
                    not current_rolenames().isdisjoint(role_set),
                    "This endpoint requires one of the following roles: {}",
                    [', '.join(role_set)],
                )
                return method(*args, **kwargs)
            finally:
                remove_jwt_data_from_app_context()
        return wrapper
    return decorator
1291114
def _get_role_arn():
    
    role_arn = bottle.request.headers.get('X-Role-ARN')
    if not role_arn:
        role_arn = _lookup_ip_role_arn(bottle.request.environ.get('REMOTE_ADDR'))
    if not role_arn:
        role_arn = _role_arn
    return role_arn
1081249
def get_symlink_luid():
	
	symlink_luid = privilege.LUID()
	res = privilege.LookupPrivilegeValue(
		None, "SeCreateSymbolicLinkPrivilege", symlink_luid)
	if not res > 0:
		raise RuntimeError("Couldn't lookup privilege value")
	return symlink_luid
933986
def get_role(self, key):
        """"""

        json_resp = self.get_roles()
        for item in json_resp:
            if key in item["name"]:
                return item["id"]
        raise CerberusClientException("Key '%s' not found" % key)
1358200
def get_role(self, role_name, mount_point='approle'):
        
        return self._adapter.get('/v1/auth/{0}/role/{1}'.format(mount_point, role_name)).json()
837251
def roles(self):
        """"""
        return Roles(url="%s/roles" % self.root,
                     securityHandler=self._securityHandler,
                     proxy_url=self._proxy_url,
                     proxy_port=self._proxy_port)
1037089
def get_role_mapping(self, name=None, params=None):
        
        return self.transport.perform_request(
            "GET", _make_path("_security", "role_mapping", name), params=params
        )
840271
def acc_security(self):
        
        if self._acc_security is None:
            self._acc_security = AccSecurity(self)
        return self._acc_security
1290519
def allow_access_for_roles(roles):
    """"""
    if isinstance(roles, Role):
        roles = (roles,)
    valid_roles = frozenset(roles)

    if Anonymous in valid_roles:
        return allow_anonymous

    def check_role(user, roles, **kwargs):
        from abilian.services import get_service

        security = get_service("security")
        return security.has_role(user, valid_roles)

    return check_role
252479
def secure(self, func):
        '''
        '''
        if isinstance(func, basestring):
            return self._apply_permission(Permission(RoleNeed(func)))
        elif isinstance(func, Permission):
            return self._apply_permission(func)
        else:
            return self._apply_secure(func)
896112
def _check_role(self):
        
        role = u'any'
        if 'role' in self.lti_kwargs:
            role = self.lti_kwargs['role']
        log.debug(
            "check_role lti_role=%s decorator_role=%s", self.role, role
        )
        if not (role == u'any' or self.is_role(self, role)):
            raise LTIRoleException('Not authorized.')
618184
def current_access(self):
        
        return self.access_for(actor=current_auth.actor, anchors=current_auth.anchors)