Merge "Add policy directive into policy.rst"

This commit is contained in:
Jenkins 2016-02-05 05:05:16 +00:00 committed by Gerrit Code Review
commit f2d7de8f57
1 changed files with 12 additions and 0 deletions

View File

@ -145,6 +145,18 @@ An Example looks like::
policy.ifAllowed({ rules: rules }).then(policySuccess, policyFailed);
}
The fourth way to add a role based check is in html files. Use angular directive 'hz-if-policies'
in file 'openstack_dashboard.static.app.core.cloud-services.hz-if-policies-directive.js'.
Assume you have the following policy defined in your angular controller::
ctrl.policy = { rules: [["identity", "identity:update_user"]] }
Then in your HTML, use it like so::
<div hz-if-policies='ctrl.policy'>
<span>I am visible if the policy is allowed!</span>
</div>
.. _rule_targets:
Rule Targets