| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561 |
- ## Licensed to Cloudera, Inc. under one
- ## or more contributor license agreements. See the NOTICE file
- ## distributed with this work for additional information
- ## regarding copyright ownership. Cloudera, Inc. licenses this file
- ## to you under the Apache License, Version 2.0 (the
- ## "License"); you may not use this file except in compliance
- ## with the License. You may obtain a copy of the License at
- ##
- ## http://www.apache.org/licenses/LICENSE-2.0
- ##
- ## Unless required by applicable law or agreed to in writing, software
- ## distributed under the License is distributed on an "AS IS" BASIS,
- ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ## See the License for the specific language governing permissions and
- ## limitations under the License.
- <%!
- from desktop.views import commonheader, commonfooter
- from django.utils.translation import ugettext as _
- %>
- <%namespace name="actionbar" file="actionbar.mako" />
- <%namespace name="layout" file="layout.mako" />
- <%namespace name="tree" file="common_tree.mako" />
- ${ commonheader(_('Hadoop Security'), "security", user) | n,unicode }
- ${ layout.menubar(section='hive') }
- <script type="text/html" id="role">
- <div class="acl-block-title"><i class="fa fa-cube muted"></i> <a class="pointer" data-bind="click: function(){ $root.showRole($data); }"><span data-bind="text: name"></span></a></div>
- <div data-bind="template: { name: 'privilege', foreach: privileges }"></div>
- <div class="acl-block acl-actions" data-bind="click: privilegesChanged().length == 0 ? addPrivilege : void(0)">
- <span class="pointer" data-bind="click: addPrivilege" title="${ _('Add privilege') }"><i class="fa fa-plus"></i></span>
- <span class="pointer" data-bind="click: $root.list_sentry_privileges_by_authorizable, visible: privilegesChanged().length > 0" title="${ _('Undo') }"> <i class="fa fa-undo"></i></span>
- <span class="pointer" data-bind="click: $root.role.savePrivileges, visible: privilegesChanged().length > 0" title="${ _('Save') }"> <i class="fa fa-save"></i></span>
- </div>
- </script>
- <script type="text/html" id="privilege">
- <div data-bind="visible: status() != 'deleted' && status() != 'alreadydeleted'" class="acl-block acl-block-airy">
- <!-- ko if: editing() -->
- <div class="pull-right">
- <a class="pointer" style="margin-right: 4px" data-bind="click: function() { if (editing()) { editing(false); }}"><i class="fa fa-eye"></i></a>
- <a class="pointer" style="margin-right: 4px" data-bind="click: remove"><i class="fa fa-times"></i></a>
- </div>
- <input value="db" data-bind="attr: { name: 'privilege-' + $index() }, checked: type" type="radio" />
- <input type="text" data-bind="hivechooser: $data.path, enable: type() == 'db'" placeholder="dbName.tableName">
- <input value="uri" data-bind="attr: { name: 'privilege-' + $index() }, checked: type" type="radio"/>
- <input type="text" data-bind="filechooser: $data.URI, enable: type() == 'uri'" placeholder="URI">
- <select data-bind="options: $root.availableActions, select2: { update: $data.action, type: 'action'}" style="width: 100px"></select>
- <span class="showAdvancedSpace"> </span><a class="pointer showAdvanced" data-bind="click: function(){ showAdvanced(true); }, visible: ! showAdvanced()"><i class="fa fa-cog"></i> ${ _('Show advanced') }</a>
- <div class="acl-block-section" data-bind="visible: showAdvanced">
- <input type="text" data-bind="value: serverName" placeholder="serverName">
- <select data-bind="options: $root.availablePrivileges, select2: { update: $data.privilegeScope, type: 'scope'}" style="width: 100px"></select>
- </div>
- <!-- /ko -->
-
- <!-- ko ifnot: editing() -->
- <div class="pull-right">
- <a class="pointer" style="margin-right: 4px" data-bind="click: function() { if (! editing()) { editing(true); }}"><i class="fa fa-pencil"></i></a>
- <a class="pointer" style="margin-right: 4px" data-bind="click: remove"><i class="fa fa-times"></i></a>
- </div>
- <em class="muted" data-bind="text: moment(timestamp()).fromNow()"></em> <span class="muted" data-bind="text: privilegeScope"></span><br/>
-
- server=<span data-bind="text: serverName"></span>
-
- <!-- ko ifnot: URI() -->
- <span data-bind="visible: dbName">
- <i class="fa fa-long-arrow-right"></i> db=<a data-bind="attr: { href: '/metastore/tables/' + dbName() }" target="_blank"><span data-bind="text: dbName"></span></a>
- </span>
- <span data-bind="visible: tableName">
- <i class="fa fa-long-arrow-right"></i> table=<a data-bind="attr: { href: '/metastore/table/' + dbName() + '/' + tableName() }" target="_blank"><span data-bind="text: tableName"></span></a>
- </span>
- <i class="fa fa-long-arrow-right"></i> action=<span data-bind="text: action"></span>
- <!-- /ko -->
-
- <!-- ko if: URI() -->
- <span data-bind="text: URI"></span>
- <!-- /ko -->
- <br/>
- <span data-bind="text: grantor"></span>
- <!-- /ko -->
- </div>
- </script>
- <div class="container-fluid">
- <div class="row-fluid">
- <div class="span2">
- <div class="sidebar-nav">
- <ul class="nav nav-list">
- <li class="nav-header">${ _('Privileges') }</li>
- <li class="active"><a href="javascript:void(0)" data-toggleSection="edit"><i class="fa fa-sitemap fa-rotate-270"></i> ${ _('Browse') }</a></li>
- <li><a href="javascript:void(0)" data-toggleSection="roles"><i class="fa fa-cubes"></i> ${ _('Roles') }</a></li>
- <li class="nav-header"><i class="fa fa-group"></i> ${ _('Groups') }
- <div>
- <br/>
- <select id="selectedGroup" data-bind="options: $root.selectableHadoopGroups, select2: { update: $data.action, type: 'action', allowClear: true }" style="width: 100%"></select>
- </div>
- </li>
- </ul>
- </div>
- </div>
- <div class="span10">
- <div id="edit" class="mainSection card card-small">
- <h1 class="card-heading simple">
- ${ _('Database and Tables privileges') }
- </h1>
- <div class="card-body">
- <div class="row-fluid">
- <div class="span6">
- <div class="path-container">
- <div class="input-append span12">
- <input id="path" class="path" type="text" autocomplete="off" />
- <a data-bind="attr: { href: '/metastore/' + $root.assist.path() }" target="_blank" title="${ _('Open in Metastore Browser') }" class="btn btn-inverse">
- <i class="fa fa-external-link"></i>
- </a>
- </div>
- <div class="clearfix"></div>
- <div class="tree-toolbar">
- <div class="pull-right">
- <div class="dropdown inline-block" style="margin-right: 6px">
- <a class="dropdown-toggle" data-toggle="dropdown" href="#">
- <i class="fa fa-eye-slash" data-bind="visible: $root.assist.isDiffMode"></i>
- <i class="fa fa-eye" data-bind="visible: ! $root.assist.isDiffMode()"></i>
- <span data-bind="visible: $root.assist.isDiffMode">${ _('Show non accessible paths for') }</span>
- <span data-bind="visible: ! $root.assist.isDiffMode()">${ _('Impersonate the user') }</span>
- </a>
- <ul class="dropdown-menu">
- <li data-bind="visible: ! $root.assist.isDiffMode(), click: function() { $root.assist.isDiffMode(true); }">
- <a tabindex="-1" href="#">${ _('Show non accessible paths for') }</a>
- </li>
- <li data-bind="visible: $root.assist.isDiffMode(), click: function() { $root.assist.isDiffMode(false); }">
- <a tabindex="-1" href="#">${ _('Impersonate the user') }</a>
- </li>
- </ul>
- </div>
- <select class="user-list" data-bind="options: $root.selectableHadoopUsers, select2: { placeholder: '${ _("Select a user") }', update: $root.doAs, type: 'user'}" style="width: 120px"></select>
- <i class="fa fa-group" title="${ _('List of groups in popover for this user?') }"></i>
- </div>
- <div>
- <i class="fa fa-spinner fa-spin" data-bind="visible: $root.assist.isLoadingTree()"></i>
- <a class="pointer" data-bind="click: $root.assist.collapseOthers" rel="tooltip" data-placement="right" title="${_('Close other nodes')}">
- <i class="fa fa-compress"></i>
- </a>
-
- <a class="pointer" data-bind="click: $root.assist.refreshTree" rel="tooltip" data-placement="right" title="${_('Refresh the tree')}">
- <i class="fa fa-refresh"></i>
- </a>
-
- <a class="pointer" data-bind="visible: $root.assist.checkedItems().length > 0, click: function(){ $('#bulkActionsModal').modal('show'); }" rel="tooltip" data-placement="right" title="${ _('Add, replace or remove ACLs for the checked paths') }">
- <i class="fa fa-copy"></i>
- </a>
- </div>
- </div>
- </div>
- ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender') }
- </div>
- <div class="span6 acl-panel">
- <div class="acl-panel-content">
- <h4 style="margin-top: 4px">${ _('Privileges') }</h4>
- <div data-bind="visible: $root.assist.privileges().length == 0"><em class="muted">${ _('No privileges found for the selected item.')} <a class="pointer" data-bind="click: function(){ $root.showCreateRole(true); $('#createRoleModal').modal('show'); }">${ _('Click here to add a new role.') }</a> </em></div>
- <div data-bind="template: { name: 'role', foreach: $root.assist.roles }"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="roles" class="mainSection hide card card-small">
- <h1 class="card-heading simple">
- ${ _('Roles') }
- </h1>
- <div class="card-body">
- <div class="span10 offset1 center" style="cursor: pointer" data-bind="visible: $root.roles().length == 0, click: function(){ $root.showCreateRole(true); $('#createRoleModal').modal('show'); }">
- <i class="fa fa-plus-circle waiting"></i>
- <h1 class="emptyMessage">${ _('There are currently no roles defined.') }<br/><a class="pointer">${ _('Click here to add') }</a> ${ _('one.') }</h1>
- </div>
- <div class="clearfix" data-bind="visible: $root.roles().length == 0"></div>
- <div data-bind="visible: $root.roles().length > 0">
- <%actionbar:render>
- <%def name="search()">
- <input id="filterInput" type="text" class="input-xlarge search-query" placeholder="${_('Search for name, groups, etc...')}" data-bind="value: $root.roleFilter, valueUpdate: 'afterkeydown'">
- </%def>
- <%def name="actions()">
- <button class="btn toolbarBtn" data-bind="click: $root.expandSelectedRoles, enable: $root.selectedRoles().length > 0"><i class="fa fa-expand"></i> ${ _('Expand') }</button>
- <button class="btn toolbarBtn" data-bind="click: function(){ $('#deleteRoleModal').modal('show'); }, enable: $root.selectedRoles().length > 0"><i class="fa fa-times"></i> ${ _('Delete') }</button>
- </%def>
- <%def name="creation()">
- <a data-bind="click: function(){ $root.showCreateRole(true); $('#createRoleModal').modal('show'); }" class="btn pointer"><i class="fa fa-plus-circle"></i> ${ _('Add') }</a>
- </%def>
- </%actionbar:render>
- </div>
- <table class="card-marginbottom" data-bind="visible: $root.roles().length > 0">
- <thead>
- <th width="1%"><div data-bind="click: $root.selectAllRoles, css: { hueCheckbox: true, 'fa': true, 'fa-check': allRolesSelected }"></div></th>
- <th width="2%"></th>
- <th width="20%">${ _('Name') }</th>
- <th width="54%">${ _('Groups') }</th>
- <th width="20%">${ _('Grantor Principal') }</th>
- <th width="3%"></th>
- </thead>
- <tbody data-bind="foreach: $root.filteredRoles">
- <tr>
- <td class="center" data-bind="click: handleSelect" style="cursor: default">
- <div data-bind="css: { hueCheckbox: true, 'fa': true, 'fa-check': selected }"></div>
- </td>
- <td class="center">
- <a href="javascript:void(0);" title="${ _('Show privileges') }">
- <i class="fa fa-2x fa-caret" data-bind="click: function() { if (showPrivileges()) { showPrivileges(false); } else { $root.list_sentry_privileges_by_role($data);} }, css: {'fa-caret-right' : ! showPrivileges(), 'fa-caret-down': showPrivileges() }"></i>
- </a>
- </td>
- <td>
- <a data-bind="attr: {'href': name}"></a>
- <i class="fa fa-cube muted"></i>
- <span data-bind="text: name, click: function() { if (showPrivileges()) { showPrivileges(false); } else { $root.list_sentry_privileges_by_role($data);} }" class="pointer"/>
- </td>
- <td>
- <a class="pointer" data-bind="click: function() { showEditGroups(true); }">
- <span data-bind="foreach: groups, visible: ! showEditGroups() && ! groupsChanged()">
- <span data-bind="text: $data"></span>
- </span>
- <span data-bind="visible: ! showEditGroups() && ! groupsChanged() && groups().length == 0">
- <i class="fa fa-plus"></i> ${ _('Add a group') }
- </span>
- </a>
- <div data-bind="visible: showEditGroups() || groupsChanged()">
- <select data-bind="options: $root.selectableHadoopGroups, selectedOptions: groups, select2: { update: groups, type: 'group'}" size="5" multiple="true" style="width: 400px"></select>
- <a class="pointer" data-bind="visible: groupsChanged, click: resetGroups">
- <i class="fa fa-undo"></i>
- </a>
- <a class="pointer" data-bind="visible: groupsChanged, click: saveGroups">
- <i class="fa fa-save"></i>
- </a>
- </div>
- </td>
- <td>
- <a href=""><span data-bind="text: grantorPrincipal"></span></a>
- </td>
- <td>
- </td>
- </tr>
- <tr>
- <td colspan="2"></td>
- <td colspan="4">
- <div data-bind="template: { name: 'privilege', foreach: $data.privileges }, visible: $data.showPrivileges">
- </div>
- </td>
- </tr>
- <tr data-bind="visible: $data.showPrivileges">
- <td colspan="2"></td>
- <td colspan="4">
- <div class="acl-block acl-actions" data-bind="click: privilegesChanged().length == 0 ? addPrivilege : void(0)">
- <span class="pointer" data-bind="click: addPrivilege, visible: $data.showPrivileges" title="${ _('Add privilege') }"><i class="fa fa-plus"></i></span>
- <span class="pointer" data-bind="click: $root.list_sentry_privileges_by_role, visible: privilegesChanged().length > 0" title="${ _('Undo') }"> <i class="fa fa-undo"></i></span>
- <span class="pointer" data-bind="click: $root.role.savePrivileges, visible: privilegesChanged().length > 0" title="${ _('Save') }"> <i class="fa fa-save"></i></span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div> <!-- /span10 -->
- </div>
- <div id="createRoleModal" class="modal hide fade in" role="dialog">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h3>${ _('Add role') }</h3>
- </div>
- <div class="modal-body" data-bind="with: $root.role, visible: showCreateRole">
- <div class="row-fluid">
- <div class="span6">
- <h4>${ _('Name') }</h4>
- <input type="text" class="input-xlarge" data-bind="value: $data.name" placeholder="${ _('Required') }" style="width: 360px" />
- </div>
- <div class="span6">
- <h4>${ _('Groups') }</h4>
- <select data-bind="options: $root.selectableHadoopGroups, selectedOptions: groups, select2: { update: groups, type: 'group', placeholder: '${ _("Optional") }' }" size="5" multiple="true" style="width: 360px"></select>
- </div>
- </div>
- <h4>${ _('Privileges') }</h4>
- <div data-bind="template: { name: 'privilege', foreach: privileges }"></div>
- <div class="acl-block acl-actions pointer" data-bind="click: addPrivilege">
- <span class="pointer" title="${ _('Add privilege') }"><i class="fa fa-plus"></i></span>
- </div>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true" data-bind="click: $root.role.reset">${ _('Cancel') }</button>
- <button data-loading-text="${ _('Saving...') }" class="btn btn-primary disable-enter" data-bind="click: $root.role.create">${ _('Save') }</button>
- </div>
- </div>
- <div id="deleteRoleModal" class="modal hide fade in" role="dialog">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3>${ _('Do you really want to delete the selected role(s)?') }</h3>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">${ _('Cancel') }</button>
- <button data-loading-text="${ _('Deleting...') }" class="btn btn-danger" data-bind="click: $root.deleteSelectedRoles">${ _('Yes') }</button>
- </div>
- </div>
- <div id="bulkActionsModal" class="modal hide fade in" role="dialog">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3>${ _('Apply some bulk operations') }</h3>
- </div>
- <div class="modal-body" style="overflow-x: hidden">
- <div class="row-fluid">
- <div class="span6">
- <h4>${ _('Checked items') }</h4>
- <ul class="unstyled modal-panel" data-bind="foreach: $root.assist.checkedItems">
- <li><span class="force-word-break" data-bind="text: path"></span></li>
- </ul>
- </div>
- <div class="span6">
- <h4>${ _('Selected item for privilege actions') }</h4>
- <div data-bind="visible: $root.assist.privileges().length == 0"><em class="muted">${ _('No privileges found for the selected item.')}</em></div>
- <div data-bind="template: { name: 'role', foreach: $root.assist.roles }" class="modal-panel"></div>
- </div>
- </div>
- <h4>${ _('Choose your action') }</h4>
- <div class="row-fluid">
- <div class="span4 center">
- <div class="big-btn" data-bind="css: {'selected': $root.bulkAction() == 'add'}, click: function(){$root.bulkAction('add')}">
- <i class="fa fa-plus"></i><br/><br/>
- <span class="bulk-action-description">${ _('Add current privileges to checkbox selection') }</span>
- </div>
- </div>
- <div class="span4 center">
- <div class="big-btn" data-bind="css: {'selected': $root.bulkAction() == 'sync'}, click: function(){$root.bulkAction('sync')}">
- <i class="fa fa-eraser"></i><br/><br/>
- <span class="bulk-action-description">${ _('Replace checkbox selection with current privileges') }</span>
- </div>
- </div>
- <div class="span4 center">
- <div class="big-btn" data-bind="css: {'selected': $root.bulkAction() == 'delete'}, click: function(){$root.bulkAction('delete')}">
- <i class="fa fa-times"></i><br/><br/>
- <span class="bulk-action-description">${ _('Remove privileges of checkbox selection') }</span>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">${ _('Cancel') }</button>
- <button class="btn" data-bind="css: {'btn-primary': $root.bulkAction() != 'delete', 'btn-danger': $root.bulkAction() == 'delete'}, click: $root.bulkPerfomAction">${ _('Confirm') }</button>
- </div>
- </div>
- <div id="chooseFile" class="modal hide fade">
- <div class="modal-header">
- <a href="#" class="close" data-dismiss="modal">×</a>
- <h3>${_('Choose a file')}</h3>
- </div>
- <div class="modal-body">
- <div id="filechooser">
- </div>
- </div>
- <div class="modal-footer">
- </div>
- </div>
- <%def name="treeIcons()">
- 'fa-database': isDb(),
- 'fa-table': isTable(),
- 'fa-columns': isColumn()
- </%def>
- ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked') }
- <script src="/static/ext/js/knockout-min.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/knockout.mapping-2.3.2.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/routie-0.3.0.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="/security/static/js/common.ko.js" type="text/javascript" charset="utf-8"></script>
- <script src="/security/static/js/hive.ko.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/ext/js/moment.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/js/jquery.hiveautocomplete.js" type="text/javascript" charset="utf-8"></script>
- <script src="/static/js/jquery.filechooser.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript" charset="utf-8">
- var viewModel = new HiveViewModel(${ initial | n,unicode });
- ko.applyBindings(viewModel);
- $(document).ready(function () {
- var _initialPath = viewModel.getPathHash();
- viewModel.init(_initialPath);
- $("#path").val(_initialPath);
- function setPathFromAutocomplete(path){
- if (path.lastIndexOf(".") == path.length -1){
- path = path.substring(0, path.length - 1);
- }
- viewModel.assist.path(path);
- viewModel.assist.updatePathProperty(viewModel.assist.growingTree(), path, "isExpanded", true);
- viewModel.assist.fetchHivePath();
- }
- $("#path").jHueHiveAutocomplete({
- skipColumns: true,
- home: viewModel.assist.path(),
- onPathChange: function (path) {
- setPathFromAutocomplete(path);
- },
- onEnter: function (el) {
- setPathFromAutocomplete(el.val());
- },
- smartTooltip: "${_('Did you know? You can use the tab key or CTRL + Space to autocomplete file and folder names')}"
- });
- function resizeComponents() {
- $("#path").width($(".tree-toolbar").width() - 64);
- $("#expandableTree").height($(window).height() - 260);
- $(".acl-panel-content").height($(window).height() - 240);
- }
- resizeComponents();
- $(document).on("rendered.tree", function() {
- var _path = viewModel.assist.path();
- if (_path[_path.length-1] == "/"){
- _path = _path.substr(0, _path.length - 1);
- }
- if ($("a.anchor[href^='"+_path+"']").length > 0){
- $("#expandableTree").animate({
- scrollTop: ($("a.anchor[href^='"+_path+"']:first").position().top + $("#expandableTree").scrollTop() - $("#expandableTree").position().top - 4)+"px"
- });
- }
- });
- $(document).on("created.role", function(){
- $("#createRoleModal").modal("hide");
- });
- $(document).on("deleted.role", function(){
- $("#deleteRoleModal").modal("hide");
- });
- $(document).on("changed.path", function(){
- if ($("#path").val() != viewModel.assist.path()){
- $("#path").val(viewModel.assist.path());
- }
- });
- function showMainSection(mainSection) {
- if ($("#" + mainSection).is(":hidden")) {
- $(".mainSection").hide();
- $("#" + mainSection).show();
- highlightMainMenu(mainSection);
- viewModel.updateSectionHash(mainSection);
- }
- logGA(mainSection);
- }
- function highlightMainMenu(mainSection) {
- $(".nav.nav-list li").removeClass("active");
- $("a[data-toggleSection='" + mainSection + "']").parent().addClass("active");
- }
- $("[data-toggleSection]").on("click", function(){
- showMainSection($(this).attr("data-toggleSection"));
- });
- showMainSection(viewModel.getSectionHash());
- $(document).on("show.role", function(e, role) {
- if (typeof role != "undefined" && role.name != null){
- $("#bulkActionsModal").modal("hide");
- showMainSection("roles");
- $("html, body").animate({
- scrollTop: ($("a[href='" + role.name() + "']").position().top - 90)+"px"
- });
- }
- });
- var _resizeTimeout = -1;
- $(window).resize(function(){
- window.clearTimeout(_resizeTimeout);
- _resizeTimeout = window.setTimeout(resizeComponents, 100);
- });
- window.onpopstate = function() {
- viewModel.assist.path(viewModel.getPathHash());
- };
- $("#createRoleModal").modal({
- show: false
- });
- $("#deleteRoleModal").modal({
- show: false
- });
- $("#selectedGroup").select2("val", "");
- $("#selectedGroup").change(function() {
- viewModel.list_sentry_privileges_by_authorizable();
- viewModel.list_sentry_roles_by_group();
- });
- $(document).on("added.bulk.privileges", function() {
- $(document).trigger("info", "${ _('The current privileges have been successfully added to the checked items.') }");
- $("#bulkActionsModal").modal("hide");
- });
- $(document).on("deleted.bulk.privileges", function() {
- $(document).trigger("info", "${ _('All the privileges have been successfully removed from the checked items.') }");
- $("#bulkActionsModal").modal("hide");
- });
- $(document).on("syncd.bulk.privileges", function() {
- $(document).trigger("info", "${ _('All the privileges for the checked items have been replaced with the current selection.') }");
- $("#bulkActionsModal").modal("hide");
- });
- $("#bulkActionsModal").modal({
- show: false
- });
- });
- </script>
- ${ commonfooter(messages) | n,unicode }
|