Enable permission check according to the new permissions

revert-70aa11f8
kamidu 8 years ago
parent 2d864bf02e
commit 2cd5a0e659

@ -56,7 +56,7 @@ function onRequest(context) {
page["noPolicy"] = true; page["noPolicy"] = true;
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/policies/delete")) { if (userModule.isAuthorized("/permission/admin/device-mgt/policies/manage")) {
page.managePermitted = true; page.managePermitted = true;
} }
return page; return page;

@ -38,5 +38,14 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}}
{{unit "cdmf.unit.policy.priority"}} {{unit "cdmf.unit.policy.priority"}}
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter Policy Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}

@ -26,4 +26,7 @@ function onRequest(context){
return options.fn(this); return options.fn(this);
} }
}); });
var viewModel = {};
viewModel.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage");
return viewModel;
} }

@ -16,6 +16,7 @@
under the License. under the License.
}} }}
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="container col-centered wr-content policy-platform"> <div class="container col-centered wr-content policy-platform">
@ -28,28 +29,28 @@
<div class="wiz-no">1</div> <div class="wiz-no">1</div>
<div class="wiz-lbl hidden-xs"><span>Select a platform</span></div> <div class="wiz-lbl hidden-xs"><span>Select a platform</span></div>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
<div class="col-md-3 col-xs-3"> <div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-profile"> <div class="itm-wiz" data-step="policy-profile">
<div class="wiz-no">2</div> <div class="wiz-no">2</div>
<div class="wiz-lbl hidden-xs"><span>Configure profile</span></div> <div class="wiz-lbl hidden-xs"><span>Configure profile</span></div>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
<div class="col-md-3 col-xs-3"> <div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-criteria"> <div class="itm-wiz" data-step="policy-criteria">
<div class="wiz-no">3</div> <div class="wiz-no">3</div>
<div class="wiz-lbl hidden-xs"><span>Assign</span></div> <div class="wiz-lbl hidden-xs"><span>Assign</span></div>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
<div class="col-md-3 col-xs-3"> <div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-naming"> <div class="itm-wiz" data-step="policy-naming">
<div class="wiz-no">4</div> <div class="wiz-no">4</div>
<div class="wiz-lbl hidden-xs"><span>Publish to devices</span></div> <div class="wiz-lbl hidden-xs"><span>Publish to devices</span></div>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
</div> </div>
<hr> <hr>
@ -82,4 +83,12 @@
<!-- content --> <!-- content -->
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter Policy Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}

@ -24,6 +24,8 @@ function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var types = {}; var types = {};
types.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage");
types["types"] = []; types["types"] = [];
var typesListResponse = deviceModule.getDeviceTypes(); var typesListResponse = deviceModule.getDeviceTypes();
if (typesListResponse["status"] == "success") { if (typesListResponse["status"] == "success") {

@ -1,29 +1,41 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized }}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="wr-steps hidden"> <div class="wr-steps hidden">
<div class="col-md-3 col-xs-3"> <div class="col-md-3 col-xs-3">
<div class="itm-wiz itm-wiz-current" data-step="policy-profile"><div class="wiz-no">1</div><div class="wiz-lbl hidden-xs"><span>Edit current profile</span></div></div> <div class="itm-wiz itm-wiz-current" data-step="policy-profile">
<br class="c-both" /> <div class="wiz-no">1</div>
<div class="wiz-lbl hidden-xs"><span>Edit current profile</span></div>
</div>
<br class="c-both"/>
</div> </div>
<div class="col-md-3 col-xs-3"> <div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-criteria"><div class="wiz-no">2</div><div class="wiz-lbl hidden-xs"><span>Edit assignment groups</span></div></div> <div class="itm-wiz" data-step="policy-criteria">
<br class="c-both" /> <div class="wiz-no">2</div>
<div class="wiz-lbl hidden-xs"><span>Edit assignment groups</span></div>
</div>
<br class="c-both"/>
</div> </div>
<div class="col-md-3 col-xs-3"> <div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-naming"><div class="wiz-no">3</div><div class="wiz-lbl hidden-xs"><span>Republish to devices</span></div></div> <div class="itm-wiz" data-step="policy-naming">
<br class="c-both" /> <div class="wiz-no">3</div>
<div class="wiz-lbl hidden-xs"><span>Republish to devices</span></div>
</div>
<br class="c-both"/>
</div> </div>
</div> </div>
<div class="container col-centered wr-content policy-message hidden"> <div class="container col-centered wr-content policy-message hidden">
<div class="wr-form"> <div class="wr-form">
<h1 id="policy-message-page-wizard-title" class="page-sub-title">Policy is successfully re-configured.</h1> <h1 id="policy-message-page-wizard-title" class="page-sub-title">Policy is successfully
re-configured.</h1>
<br>Please click <b>"Add Another Policy"</b>, if you wish to add another policy or click <br>Please click <b>"Add Another Policy"</b>, if you wish to add another policy or click
<b>"View policy list"</b> to complete the process and go back to the policy list. <b>"View policy list"</b> to complete the process and go back to the policy list.
<hr> <hr>
<button class="wr-btn wizard-stepper" data-current="policy-message" data-direct="/emm/policies/"> <button class="wr-btn wizard-stepper" data-current="policy-message"
data-direct="/emm/policies/">
View policy list View policy list
</button> </button>
<a href="/emm/policies/add-policy" class="cu-btn-inner"> <a href="/emm/policies/add-policy" class="cu-btn-inner">
@ -56,30 +68,36 @@
</label> </label>
<div id="policy-name-field" class="form-group wr-input-control"> <div id="policy-name-field" class="form-group wr-input-control">
<div class="cus-col-50"> <div class="cus-col-50">
<input id="policy-name-input" class="form-control" type="text" value="" placeholder="[ Required field ]"/> <input id="policy-name-input" class="form-control" type="text" value=""
placeholder="[ Required field ]"/>
</div> </div>
<br class="c-both"/> <br class="c-both"/>
<span class=" nameError hidden glyphicon glyphicon-remove form-control-feedback"></span> <span class=" nameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error nameEmpty hidden" for="summary">Policy name is required & Should be be 1-to-30 characters long.</label> <label class="error nameEmpty hidden" for="summary">Policy name is required &
Should be be 1-to-30 characters long.</label>
</div> </div>
<label class="wr-input-label"> <label class="wr-input-label">
Add a description Add a description
</label> </label>
<div class="wr-input-control"> <div class="wr-input-control">
<div class="cus-col-50"> <div class="cus-col-50">
<textarea id="policy-description-input" class="form-control" rows="10" placeholder="[ Optional field ]"></textarea> <textarea id="policy-description-input" class="form-control" rows="10"
placeholder="[ Optional field ]"></textarea>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
</div> </div>
<div class="wr-input-control wr-btn-grp"> <div class="wr-input-control wr-btn-grp">
<a href="#" class="wr-btn wizard-stepper" data-is-back-btn="true" data-current="policy-naming" data-next="policy-criteria"> <a href="#" class="wr-btn wizard-stepper" data-is-back-btn="true"
data-current="policy-naming" data-next="policy-criteria">
Back Back
</a> </a>
<a href="#" class="wr-btn wizard-stepper" data-current="policy-naming-publish" data-next="policy-message" data-validate="true"> <a href="#" class="wr-btn wizard-stepper" data-current="policy-naming-publish"
data-next="policy-message" data-validate="true">
Save & Publish Save & Publish
</a> </a>
<a href="#" class="wr-btn wizard-stepper" data-current="policy-naming" data-next="policy-message" data-validate="true"> <a href="#" class="wr-btn wizard-stepper" data-current="policy-naming"
data-next="policy-message" data-validate="true">
Save Save
</a> </a>
@ -110,46 +128,50 @@
<div class="cus-col-50"> <div class="cus-col-50">
<select id="ownership-input" class="form-control"> <select id="ownership-input" class="form-control">
<option value="ANY" selected>ANY</option> <option value="ANY" selected>ANY</option>
<option value="BYOD">BYOD (Bring Your Own Device) </option> <option value="BYOD">BYOD (Bring Your Own Device)</option>
<option value="COPE">COPE (Corporate-Owned, Personally Enabled)</option> <option value="COPE">COPE (Corporate-Owned, Personally Enabled)</option>
</select> </select>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-control radio light"> <label class="wr-input-control radio light">
<input id="user-roles-radio-btn" type="radio" name="select-users-radio-btn" class="select-users-radio" checked/> <input id="user-roles-radio-btn" type="radio" name="select-users-radio-btn"
class="select-users-radio" checked/>
<span class="helper">&nbsp;Set user role(s)</span> <span class="helper">&nbsp;Set user role(s)</span>
</label> </label>
<label class="wr-input-control radio light" rel="assetfilter"> <label class="wr-input-control radio light" rel="assetfilter">
<input id="users-radio-btn" type="radio" name="select-users-radio-btn" class="select-users-radio" /> <input id="users-radio-btn" type="radio" name="select-users-radio-btn"
class="select-users-radio"/>
<span class="helper">&nbsp;Set user(s)</span> <span class="helper">&nbsp;Set user(s)</span>
</label> </label>
</div> </div>
<div id="user-roles-select-field" class="select-users"> <div id="user-roles-select-field" class="select-users">
<div class="wr-input-control"> <div class="wr-input-control">
<div class="cus-col-50"> <div class="cus-col-50">
<select id="user-roles-input" class="form-control select2" multiple="multiple"> <select id="user-roles-input" class="form-control select2"
multiple="multiple">
<option value="ANY" selected>ANY</option> <option value="ANY" selected>ANY</option>
{{#each roles}} {{#each roles}}
<option>{{this}}</option> <option>{{this}}</option>
{{/each}} {{/each}}
</select> </select>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
</div> </div>
<div id="users-select-field" class="select-users"> <div id="users-select-field" class="select-users">
<div class="wr-input-control"> <div class="wr-input-control">
<div class="cus-col-50"> <div class="cus-col-50">
<select id="users-input" class="form-control select2" multiple="multiple"> <select id="users-input" class="form-control select2"
multiple="multiple">
<option value="ANY" selected>ANY</option> <option value="ANY" selected>ANY</option>
{{#each users}} {{#each users}}
<option>{{username}}</option> <option>{{username}}</option>
{{/each}} {{/each}}
</select> </select>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
</div> </div>
<br> <br>
@ -164,14 +186,16 @@
<option value="monitor" data-action="monitor">Monitor</option> <option value="monitor" data-action="monitor">Monitor</option>
</select> </select>
</div> </div>
<br class="c-both" /> <br class="c-both"/>
</div> </div>
</div> </div>
<div class="wr-input-control wr-btn-grp"> <div class="wr-input-control wr-btn-grp">
<a href="#" class="wr-btn wizard-stepper" data-is-back-btn="true" data-current="policy-criteria" data-next="policy-profile"> <a href="#" class="wr-btn wizard-stepper" data-is-back-btn="true"
data-current="policy-criteria" data-next="policy-profile">
Back Back
</a> </a>
<a href="#" class="wr-btn wizard-stepper" data-current="policy-criteria" data-next="policy-naming" data-validate="true"> <a href="#" class="wr-btn wizard-stepper" data-current="policy-criteria"
data-next="policy-naming" data-validate="true">
Continue Continue
</a> </a>
</div> </div>
@ -204,7 +228,8 @@
</div> </div>
</div> </div>
<div class="wr-input-control wr-btn-grp"> <div class="wr-input-control wr-btn-grp">
<a href="#" class="wr-btn wizard-stepper" data-current="policy-profile" data-next="policy-criteria" data-validate="true"> <a href="#" class="wr-btn wizard-stepper" data-current="policy-profile"
data-next="policy-criteria" data-validate="true">
Continue Continue
</a> </a>
</div> </div>
@ -217,6 +242,14 @@
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter Policy Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->

@ -24,13 +24,13 @@ function onRequest(context) {
var rolesResult = userModule.getRoles(); var rolesResult = userModule.getRoles();
if (rolesResult.status == "success") { if (rolesResult.status == "success") {
context.roles = rolesResult.content; viewModel.roles = rolesResult.content;
} }
var usersResult = userModule.getUsers(); var usersResult = userModule.getUsers();
if (usersResult.status == "success") { if (usersResult.status == "success") {
context.users = usersResult.content; viewModel.users = usersResult.content;
} }
viewModel.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage");
return context; return viewModel;
} }

@ -1,4 +1,5 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}}
{{#defineZone "policy-profile-top"}} {{#defineZone "policy-profile-top"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
@ -46,7 +47,8 @@
</tbody> </tbody>
</table> </table>
{{/defineZone}} {{/defineZone}}
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Description</div> <div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Description
</div>
<div class="add-margin-top-4x"> <div class="add-margin-top-4x">
<div id="policy-description" class="panel-title-description"></div> <div id="policy-description" class="panel-title-description"></div>
</div> </div>
@ -72,6 +74,14 @@
</div> </div>
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter Policy Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->

@ -21,5 +21,6 @@ function onRequest(context) {
// var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; // var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
// context.roles = userModule.getRoles(); // context.roles = userModule.getRoles();
context.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
return context; return context;
} }
Loading…
Cancel
Save