Exemplo n.º 1
0
 def _get_implied_role(self, prior_role_id, implied_role_id):
     # Isolate this logic so it can be re-used without added enforcement
     PROVIDERS.role_api.get_implied_role(
         prior_role_id, implied_role_id)
     implied_role_ref = PROVIDERS.role_api.get_role(implied_role_id)
     response_json = shared.role_inference_response(prior_role_id)
     response_json['role_inference'][
         'implies'] = shared.build_implied_role_response_data(
         implied_role_ref)
     response_json['links'] = {
         'self': ks_flask.base_url(
             path='/roles/%(prior)s/implies/%(implies)s' % {
                 'prior': prior_role_id, 'implies': implied_role_id})}
     return response_json
Exemplo n.º 2
0
 def _get_implied_role(self, prior_role_id, implied_role_id):
     # Isolate this logic so it can be re-used without added enforcement
     PROVIDERS.role_api.get_implied_role(
         prior_role_id, implied_role_id)
     implied_role_ref = PROVIDERS.role_api.get_role(implied_role_id)
     response_json = shared.role_inference_response(prior_role_id)
     response_json['role_inference'][
         'implies'] = shared.build_implied_role_response_data(
         implied_role_ref)
     response_json['links'] = {
         'self': ks_flask.base_url(
             path='/roles/%(prior)s/implies/%(implies)s' % {
                 'prior': prior_role_id, 'implies': implied_role_id})}
     return response_json
Exemplo n.º 3
0
    def get(self, prior_role_id):
        """List Implied Roles.

        GET/HEAD /v3/roles/{prior_role_id}/implies
        """
        ENFORCER.enforce_call(action='identity:list_implied_roles',
                              build_target=_build_enforcement_target_ref)
        ref = PROVIDERS.role_api.list_implied_roles(prior_role_id)
        implied_ids = [r['implied_role_id'] for r in ref]
        response_json = shared.role_inference_response(prior_role_id)
        response_json['role_inference']['implies'] = []
        for implied_id in implied_ids:
            implied_role = PROVIDERS.role_api.get_role(implied_id)
            response_json['role_inference']['implies'].append(
                shared.build_implied_role_response_data(implied_role))
        response_json['links'] = {
            'self': ks_flask.base_url(path='/roles/%s/implies' % prior_role_id)
        }
        return response_json
Exemplo n.º 4
0
    def get(self, prior_role_id):
        """List Implied Roles.

        GET/HEAD /v3/roles/{prior_role_id}/implies
        """
        ENFORCER.enforce_call(action='identity:list_implied_roles',
                              build_target=_build_enforcement_target_ref)
        ref = PROVIDERS.role_api.list_implied_roles(prior_role_id)
        implied_ids = [r['implied_role_id'] for r in ref]
        response_json = shared.role_inference_response(prior_role_id)
        response_json['role_inference']['implies'] = []
        for implied_id in implied_ids:
            implied_role = PROVIDERS.role_api.get_role(implied_id)
            response_json['role_inference']['implies'].append(
                shared.build_implied_role_response_data(implied_role))
        response_json['links'] = {
            'self': ks_flask.base_url(
                path='/roles/%s/implies' % prior_role_id)}
        return response_json