Add policy directive into policy.rst

This commit is as follow-up work of:https://review.openstack.org/#/c/261695/.
Mention how to use policy directive to complete policy.rst.

Change-Id: I64e64ba8d7fd0c2e15ffd0f460b9bb981742b4b9
Partial-Bug: #1529007
This commit is contained in:
Bo Wang 2016-01-28 13:55:50 +08:00
parent 2faa5d2ed6
commit df2701c524

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