The tacker.policy Module

The tacker.policy Module

class tacker.policy.FieldCheck(kind, match)

Bases: oslo_policy._checks.Check

class tacker.policy.OwnerCheck(kind, match)

Bases: oslo_policy._checks.Check

Resource ownership check.

This check verifies the owner of the current resource, or of another resource referenced by the one under analysis. In the former case it falls back to a regular GenericCheck, whereas in the latter case it leverages the plugin to load the referenced resource and perform the check.

tacker.policy.check(context, action, target, plugin=None, might_not_exist=False, pluralized=None)

Verifies that the action is valid on the target in this context.

Parameters:
  • context – tacker context
  • action – string representing the action to be checked this should be colon separated for clarity.
  • target – dictionary representing the object of the action for object creation this should be a dictionary representing the location of the object e.g. {'project_id': context.project_id}
  • plugin – currently unused and deprecated. Kept for backward compatibility.
  • might_not_exist – If True the policy check is skipped (and the function returns True) if the specified policy does not exist. Defaults to false.
  • pluralized – pluralized case of resource e.g. firewall_policy -> pluralized = “firewall_policies”
Returns:

Returns True if access is permitted else False.

tacker.policy.check_is_admin(context)

Verify context has admin rights according to policy settings.

tacker.policy.enforce(context, action, target, plugin=None, pluralized=None)

Verifies that the action is valid on the target in this context.

Parameters:
  • context – tacker context
  • action – string representing the action to be checked this should be colon separated for clarity.
  • target – dictionary representing the object of the action for object creation this should be a dictionary representing the location of the object e.g. {'project_id': context.project_id}
  • plugin – currently unused and deprecated. Kept for backward compatibility.
  • pluralized – pluralized case of resource e.g. firewall_policy -> pluralized = “firewall_policies”
Raises:

oslo_policy.policy.PolicyNotAuthorized – if verification fails.

tacker.policy.get_resource_and_action(action, pluralized=None)

Return resource and enforce_attr_based_check(boolean).

It is per resource and action extracted from api operation.

tacker.policy.init(conf=<oslo_config.cfg.ConfigOpts object>, policy_file=None)

Init an instance of the Enforcer class.

tacker.policy.log_rule_list(match_rule)
tacker.policy.refresh(policy_file=None)

Reset policy and init a new instance of Enforcer.

tacker.policy.reset()
tacker.policy.set_rules(policies, overwrite=True)

Set rules based on the provided dict of rules.

Parameters:
  • policies – New policies to use. It should be an instance of dict.
  • overwrite – Whether to overwrite current rules or update them with the new rules.
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.