From df2701c524020d1b652a123cb0dea98bc4933b38 Mon Sep 17 00:00:00 2001 From: Bo Wang Date: Thu, 28 Jan 2016 13:55:50 +0800 Subject: [PATCH] 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 --- doc/source/topics/policy.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/source/topics/policy.rst b/doc/source/topics/policy.rst index 2c67054b5..9a9c67625 100644 --- a/doc/source/topics/policy.rst +++ b/doc/source/topics/policy.rst @@ -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:: + +
+ I am visible if the policy is allowed! +
+ .. _rule_targets: Rule Targets