DavidPurcell | b25f93d | 2017-01-27 12:46:27 -0500 | [diff] [blame] | 1 | # Copyright 2017 AT&T Corporation. |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 16 | import copy |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 17 | import json |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 18 | import os |
| 19 | |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 20 | from oslo_log import log as logging |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 21 | from oslo_policy import policy |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 22 | import stevedore |
ghanshyam | 0df097d | 2017-08-08 09:28:17 +0300 | [diff] [blame] | 23 | from tempest import clients |
Rick Bartra | 503c557 | 2017-03-09 13:49:58 -0500 | [diff] [blame] | 24 | from tempest.common import credentials_factory as credentials |
Felipe Monteiro | 7be94e8 | 2017-07-26 02:17:08 +0100 | [diff] [blame] | 25 | from tempest import config |
Rick Bartra | 503c557 | 2017-03-09 13:49:58 -0500 | [diff] [blame] | 26 | |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 27 | from patrole_tempest_plugin import rbac_exceptions |
Rick Bartra | ed95005 | 2017-06-29 17:20:33 -0400 | [diff] [blame] | 28 | from patrole_tempest_plugin.rbac_utils import RbacAuthority |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 29 | |
Felipe Monteiro | 7be94e8 | 2017-07-26 02:17:08 +0100 | [diff] [blame] | 30 | CONF = config.CONF |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 31 | LOG = logging.getLogger(__name__) |
| 32 | |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 33 | |
Felipe Monteiro | 88a5bab | 2017-08-31 04:00:32 +0100 | [diff] [blame] | 34 | class PolicyAuthority(RbacAuthority): |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 35 | """A class that uses ``oslo.policy`` for validating RBAC.""" |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 36 | |
Felipe Monteiro | 0854ded | 2017-05-05 16:30:55 +0100 | [diff] [blame] | 37 | def __init__(self, project_id, user_id, service, extra_target_data=None): |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 38 | """Initialization of Policy Authority class. |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 39 | |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 40 | Validates whether a test role can perform a policy action by querying |
| 41 | ``oslo.policy`` with necessary test data. |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 42 | |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 43 | If a policy file does not exist, checks whether the policy file is |
| 44 | registered as a namespace under "oslo.policy.policies". Nova, for |
| 45 | example, doesn't use a policy file by default; its policies are |
| 46 | implemented in code and registered as "nova" under |
| 47 | "oslo.policy.policies". |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 48 | |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 49 | If the policy file is not found in either code or in a policy file, |
| 50 | then an exception is raised. |
| 51 | |
| 52 | Additionally, if a custom policy file exists along with the default |
| 53 | policy in code implementation, the custom policy is prioritized. |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 54 | |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 55 | :param uuid project_id: project_id of object performing API call |
| 56 | :param uuid user_id: user_id of object performing API call |
| 57 | :param string service: service of the policy file |
| 58 | :param dict extra_target_data: dictionary containing additional object |
| 59 | data needed by oslo.policy to validate generic checks |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 60 | |
| 61 | Example: |
| 62 | |
| 63 | .. code-block:: python |
| 64 | |
| 65 | # Below is the default policy implementation in code, defined in |
| 66 | # a service like Nova. |
| 67 | test_policies = [ |
| 68 | policy.DocumentedRuleDefault( |
| 69 | 'service:test_rule', |
| 70 | base.RULE_ADMIN_OR_OWNER, |
| 71 | "This is a description for a test policy", |
| 72 | [ |
| 73 | { |
| 74 | 'method': 'POST', |
| 75 | 'path': '/path/to/test/resource' |
| 76 | } |
| 77 | ]), |
| 78 | 'service:another_test_rule', |
| 79 | base.RULE_ADMIN_OR_OWNER, |
| 80 | "This is a description for another test policy", |
| 81 | [ |
| 82 | { |
| 83 | 'method': 'GET', |
| 84 | 'path': '/path/to/test/resource' |
| 85 | } |
| 86 | ]), |
| 87 | ] |
| 88 | |
| 89 | .. code-block:: yaml |
| 90 | |
| 91 | # Below is the custom override of the default policy in a YAML |
| 92 | # policy file. Note that the default rule is "rule:admin_or_owner" |
| 93 | # and the custom rule is "rule:admin_api". The `PolicyAuthority` |
| 94 | # class will use the "rule:admin_api" definition for this policy |
| 95 | # action. |
| 96 | "service:test_rule" : "rule:admin_api" |
| 97 | |
| 98 | # Note below that no override is provided for |
| 99 | # "service:another_test_rule", which means that the default policy |
| 100 | # rule is used: "rule:admin_or_owner". |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 101 | """ |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 102 | |
Felipe Monteiro | 0854ded | 2017-05-05 16:30:55 +0100 | [diff] [blame] | 103 | if extra_target_data is None: |
| 104 | extra_target_data = {} |
| 105 | |
Felipe Monteiro | d9607c4 | 2017-06-12 19:28:45 +0100 | [diff] [blame] | 106 | self.validate_service(service) |
Rick Bartra | 503c557 | 2017-03-09 13:49:58 -0500 | [diff] [blame] | 107 | |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 108 | # Prioritize dynamically searching for policy files over relying on |
| 109 | # deprecated service-specific policy file locations. |
Felipe Monteiro | bbd6a3c | 2017-11-01 01:57:49 +0000 | [diff] [blame] | 110 | self.path = None |
Felipe Monteiro | f6eb862 | 2017-08-06 06:08:02 +0100 | [diff] [blame] | 111 | if CONF.patrole.custom_policy_files: |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 112 | self.discover_policy_files() |
| 113 | self.path = self.policy_files.get(service) |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 114 | |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 115 | self.rules = policy.Rules.load(self._get_policy_data(service), |
| 116 | 'default') |
Felipe Monteiro | fd1db98 | 2017-04-13 21:19:41 +0100 | [diff] [blame] | 117 | self.project_id = project_id |
Felipe Monteiro | 889264e | 2017-03-01 17:19:35 -0500 | [diff] [blame] | 118 | self.user_id = user_id |
Felipe Monteiro | fd1db98 | 2017-04-13 21:19:41 +0100 | [diff] [blame] | 119 | self.extra_target_data = extra_target_data |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 120 | |
Felipe Monteiro | d9607c4 | 2017-06-12 19:28:45 +0100 | [diff] [blame] | 121 | @classmethod |
| 122 | def validate_service(cls, service): |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 123 | """Validate whether the service passed to ``__init__`` exists.""" |
Felipe Monteiro | d9607c4 | 2017-06-12 19:28:45 +0100 | [diff] [blame] | 124 | service = service.lower().strip() if service else None |
| 125 | |
| 126 | # Cache the list of available services in memory to avoid needlessly |
| 127 | # doing an API call every time. |
| 128 | if not hasattr(cls, 'available_services'): |
ghanshyam | 0df097d | 2017-08-08 09:28:17 +0300 | [diff] [blame] | 129 | admin_mgr = clients.Manager( |
| 130 | credentials.get_configured_admin_credentials()) |
Felipe Monteiro | 7be94e8 | 2017-07-26 02:17:08 +0100 | [diff] [blame] | 131 | services_client = (admin_mgr.identity_services_v3_client |
| 132 | if CONF.identity_feature_enabled.api_v3 |
| 133 | else admin_mgr.identity_services_client) |
| 134 | services = services_client.list_services()['services'] |
Felipe Monteiro | d9607c4 | 2017-06-12 19:28:45 +0100 | [diff] [blame] | 135 | cls.available_services = [s['name'] for s in services] |
| 136 | |
| 137 | if not service or service not in cls.available_services: |
| 138 | LOG.debug("%s is NOT a valid service.", service) |
| 139 | raise rbac_exceptions.RbacInvalidService( |
| 140 | "%s is NOT a valid service." % service) |
| 141 | |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 142 | @classmethod |
| 143 | def discover_policy_files(cls): |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 144 | """Dynamically discover the policy file for each service in |
| 145 | ``cls.available_services``. Pick the first candidate path found |
| 146 | out of the potential paths in ``[patrole] custom_policy_files``. |
| 147 | """ |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 148 | if not hasattr(cls, 'policy_files'): |
| 149 | cls.policy_files = {} |
| 150 | for service in cls.available_services: |
Felipe Monteiro | f6eb862 | 2017-08-06 06:08:02 +0100 | [diff] [blame] | 151 | for candidate_path in CONF.patrole.custom_policy_files: |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 152 | if os.path.isfile(candidate_path % service): |
| 153 | cls.policy_files.setdefault(service, |
| 154 | candidate_path % service) |
| 155 | |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 156 | def allowed(self, rule_name, role): |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 157 | """Checks if a given rule in a policy is allowed with given role. |
| 158 | |
| 159 | :param string rule_name: Rule to be checked using ``oslo.policy``. |
| 160 | :param bool is_admin: Whether admin context is used. |
| 161 | """ |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 162 | is_admin_context = self._is_admin_context(role) |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 163 | is_allowed = self._allowed( |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 164 | access=self._get_access_token(role), |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 165 | apply_rule=rule_name, |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 166 | is_admin=is_admin_context) |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 167 | return is_allowed |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 168 | |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 169 | def _get_policy_data(self, service): |
| 170 | file_policy_data = {} |
| 171 | mgr_policy_data = {} |
| 172 | policy_data = {} |
| 173 | |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 174 | # Check whether policy file exists and attempt to read it. |
| 175 | if self.path and os.path.isfile(self.path): |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 176 | try: |
Samantha Blanco | 85f79d7 | 2017-04-21 11:09:14 -0400 | [diff] [blame] | 177 | with open(self.path, 'r') as policy_file: |
| 178 | file_policy_data = policy_file.read() |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 179 | file_policy_data = json.loads(file_policy_data) |
Samantha Blanco | 85f79d7 | 2017-04-21 11:09:14 -0400 | [diff] [blame] | 180 | except (IOError, ValueError) as e: |
| 181 | msg = "Failed to read policy file for service. " |
| 182 | if isinstance(e, IOError): |
| 183 | msg += "Please check that policy path exists." |
| 184 | else: |
| 185 | msg += "JSON may be improperly formatted." |
| 186 | LOG.debug(msg) |
| 187 | file_policy_data = {} |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 188 | |
| 189 | # Check whether policy actions are defined in code. Nova and Keystone, |
| 190 | # for example, define their default policy actions in code. |
| 191 | mgr = stevedore.named.NamedExtensionManager( |
| 192 | 'oslo.policy.policies', |
| 193 | names=[service], |
| 194 | on_load_failure_callback=None, |
| 195 | invoke_on_load=True, |
| 196 | warn_on_missing_entrypoint=False) |
| 197 | |
| 198 | if mgr: |
| 199 | policy_generator = {policy.name: policy.obj for policy in mgr} |
| 200 | if policy_generator and service in policy_generator: |
| 201 | for rule in policy_generator[service]: |
| 202 | mgr_policy_data[rule.name] = str(rule.check) |
| 203 | |
| 204 | # If data from both file and code exist, combine both together. |
| 205 | if file_policy_data and mgr_policy_data: |
| 206 | # Add the policy actions from code first. |
| 207 | for action, rule in mgr_policy_data.items(): |
| 208 | policy_data[action] = rule |
| 209 | # Overwrite with any custom policy actions defined in policy.json. |
| 210 | for action, rule in file_policy_data.items(): |
| 211 | policy_data[action] = rule |
| 212 | elif file_policy_data: |
| 213 | policy_data = file_policy_data |
| 214 | elif mgr_policy_data: |
| 215 | policy_data = mgr_policy_data |
| 216 | else: |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 217 | error_message = ( |
| 218 | 'Policy file for {0} service neither found in code nor at {1}.' |
| 219 | .format(service, [loc % service for loc in |
Felipe Monteiro | f6eb862 | 2017-08-06 06:08:02 +0100 | [diff] [blame] | 220 | CONF.patrole.custom_policy_files]) |
Felipe Monteiro | 3ab2c35 | 2017-07-05 22:25:34 +0100 | [diff] [blame] | 221 | ) |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 222 | raise rbac_exceptions.RbacParsingException(error_message) |
| 223 | |
| 224 | try: |
| 225 | policy_data = json.dumps(policy_data) |
Felipe Monteiro | b580963 | 2017-10-26 04:12:12 +0100 | [diff] [blame] | 226 | except (TypeError, ValueError): |
Felipe Monteiro | ae2ebab | 2017-03-23 22:49:06 +0000 | [diff] [blame] | 227 | error_message = 'Policy file for {0} service is invalid.'.format( |
| 228 | service) |
| 229 | raise rbac_exceptions.RbacParsingException(error_message) |
| 230 | |
| 231 | return policy_data |
| 232 | |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 233 | def _is_admin_context(self, role): |
| 234 | """Checks whether a role has admin context. |
| 235 | |
| 236 | If context_is_admin is contained in the policy file, then checks |
| 237 | whether the given role is contained in context_is_admin. If it is not |
| 238 | in the policy file, then default to context_is_admin: admin. |
| 239 | """ |
| 240 | if 'context_is_admin' in self.rules.keys(): |
| 241 | return self._allowed( |
| 242 | access=self._get_access_token(role), |
| 243 | apply_rule='context_is_admin') |
Felipe Monteiro | f6b69e2 | 2017-05-04 21:55:04 +0100 | [diff] [blame] | 244 | return role == CONF.identity.admin_role |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 245 | |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 246 | def _get_access_token(self, role): |
| 247 | access_token = { |
| 248 | "token": { |
| 249 | "roles": [ |
| 250 | { |
| 251 | "name": role |
| 252 | } |
| 253 | ], |
Felipe Monteiro | fd1db98 | 2017-04-13 21:19:41 +0100 | [diff] [blame] | 254 | "project_id": self.project_id, |
| 255 | "tenant_id": self.project_id, |
Felipe Monteiro | 889264e | 2017-03-01 17:19:35 -0500 | [diff] [blame] | 256 | "user_id": self.user_id |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 257 | } |
| 258 | } |
| 259 | return access_token |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 260 | |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 261 | def _allowed(self, access, apply_rule, is_admin=False): |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 262 | """Checks if a given rule in a policy is allowed with given ``access``. |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 263 | |
Felipe Monteiro | f2b58d7 | 2017-08-31 22:40:36 +0100 | [diff] [blame] | 264 | :param dict access: Dictionary from ``_get_access_token``. |
| 265 | :param string apply_rule: Rule to be checked using ``oslo.policy``. |
| 266 | :param bool is_admin: Whether admin context is used. |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 267 | """ |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 268 | access_data = copy.copy(access['token']) |
| 269 | access_data['roles'] = [role['name'] for role in access_data['roles']] |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 270 | access_data['is_admin'] = is_admin |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 271 | # TODO(felipemonteiro): Dynamically calculate is_admin_project rather |
| 272 | # than hard-coding it to True. is_admin_project cannot be determined |
| 273 | # from the role, but rather from project and domain names. See |
| 274 | # _populate_is_admin_project in keystone.token.providers.common |
| 275 | # for more information. |
| 276 | access_data['is_admin_project'] = True |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 277 | |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 278 | class Object(object): |
| 279 | pass |
| 280 | o = Object() |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 281 | o.rules = self.rules |
DavidPurcell | 029d8c3 | 2017-01-06 15:27:41 -0500 | [diff] [blame] | 282 | |
Felipe Monteiro | 9fc782e | 2017-02-01 15:38:46 -0500 | [diff] [blame] | 283 | target = {"project_id": access_data['project_id'], |
| 284 | "tenant_id": access_data['project_id'], |
Felipe Monteiro | 889264e | 2017-03-01 17:19:35 -0500 | [diff] [blame] | 285 | "network:tenant_id": access_data['project_id'], |
| 286 | "user_id": access_data['user_id']} |
Felipe Monteiro | fd1db98 | 2017-04-13 21:19:41 +0100 | [diff] [blame] | 287 | if self.extra_target_data: |
| 288 | target.update(self.extra_target_data) |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 289 | |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 290 | result = self._try_rule(apply_rule, target, access_data, o) |
Felipe Monteiro | b059565 | 2017-01-23 16:51:58 -0500 | [diff] [blame] | 291 | return result |
| 292 | |
Felipe Monteiro | 9c97850 | 2017-01-27 17:07:54 -0500 | [diff] [blame] | 293 | def _try_rule(self, apply_rule, target, access_data, o): |
Samantha Blanco | 0d88008 | 2017-03-23 18:14:37 -0400 | [diff] [blame] | 294 | if apply_rule not in self.rules: |
Felipe Monteiro | 398a09f | 2018-01-23 01:39:25 +0000 | [diff] [blame] | 295 | message = ("Policy action \"{0}\" not found in policy file: {1} or" |
| 296 | " among registered policy in code defaults for service." |
| 297 | ).format(apply_rule, self.path) |
Felipe Monteiro | 48c913d | 2017-03-15 12:07:48 -0400 | [diff] [blame] | 298 | LOG.debug(message) |
| 299 | raise rbac_exceptions.RbacParsingException(message) |
Samantha Blanco | 0d88008 | 2017-03-23 18:14:37 -0400 | [diff] [blame] | 300 | else: |
| 301 | rule = self.rules[apply_rule] |
| 302 | return rule(target, access_data, o) |