Skip to content

Commit

Permalink
[NEW] RocketChat#8771 - fine granular settings permissions (RocketCha…
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimpson committed Aug 27, 2019
1 parent 1516599 commit 3233371
Show file tree
Hide file tree
Showing 21 changed files with 3,856 additions and 3,725 deletions.
135 changes: 65 additions & 70 deletions app/authorization/client/views/permissions.html
Original file line number Diff line number Diff line change
@@ -1,83 +1,78 @@
<template name="permissionsTable">
<div class="content">
<table class="permission-grid secondary-background-color">

<table class="permission-grid secondary-background-color">

<thead class="content-background-color">
<tr>
<th class=" role-name permission-name border-component-color"></th>
{{#each role in allRoles}}
<th class="edit-icon role-name border-component-color" title="{{role.description}}">
<a class="permission-edit" href="{{pathFor "admin-permissions-edit" name=role._id}}">
<p class="permission-label">
<div class = "rotator">
{{role._id}}
</div>
</p>
<p class="permission-icon">
<i class="icon-edit"></i>
</p>
</a>
</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each permission in permissions}}
<tr class="admin-table-row">
<td class="permission-name border-component-color" title="{{permissionDescription permission}}">{{permissionName permission}}<br><span class = "id-styler">[ID: {{permission._id}}]</span></td>
{{#each role in allRoles}}
<td class="permission-checkbox border-component-color">
<input type="checkbox" name="perm[{{role._id}}][{{permission._id}}]" class="role-permission" value="1" checked="{{granted permission.roles role}}" data-role="{{role._id}}" data-permission="{{permission._id}}">
</td>
{{/each}}
</tr>
{{/each}}
</tbody>
</table>
<thead class="content-background-color">
<tr>
<th class=" role-name permission-name border-component-color"></th>
{{#each role in allRoles}}
<th class="edit-icon role-name border-component-color" title="{{role.description}}">
<a class="permission-edit" href="{{pathFor "admin-permissions-edit" name=role._id}}">
<p class="permission-label">
<div class = "rotator">
{{role._id}}
</div>
</p>
<p class="permission-icon">
<i class="icon-edit"></i>
</p>
</a>
</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each permission in permissions}}
<tr class="admin-table-row">
<td class="permission-name border-component-color" title="{{permissionDescription permission}}">{{permissionName permission}}<br><span class = "id-styler">[ID: {{permission._id}}]</span></td>
{{#each role in allRoles}}
<td class="permission-checkbox border-component-color">
<input type="checkbox" name="perm[{{role._id}}][{{permission._id}}]" class="role-permission" value="1" checked="{{granted permission.roles role}}" data-role="{{role._id}}" data-permission="{{permission._id}}">
</td>
{{else}}
<tr class="table-no-click">
<td>{{_ "No_results_found_for"}} {{filter}}</td>
</tr>
{{/each}}
</tr>
{{/each}}
</tbody>
</table>
</div>
</template>
<template name="permissions">
<div class="page-container permissions-manager">
<section class="page-home page-static page-list">
<section class="permissions-manager page-container page-home page-static page-list">
{{#if hasPermission}}
{{# header sectionName=pageTitle}}
<div class="rc-header__section-button">
<a href="{{pathFor"admin-permissions-new"}}"
class="rc-button rc-button--primary new-role">{{_ "New_role"}}</a>
</div>
{{/header}}

<div class="content">
{{> permissionsTable permissions=permissions allRoles=roles collection='Chat'}}
</div>
{{/if}}
{{#if hasSettingPermission}}
{{# header sectionName="Setting_permissions"}}
<div class="rc-header__section-button">
<button class="rc-button rc-button--primary js-toggle-setting-permissions"><span>
{{#if settingPermissionExpanded }}
{{_ "Collapse"}}
{{else}}
{{_ "Expand"}}
{{/if}}
</span>
</button>
</div>
{{/header}}
<section class="page-home page-static page-list">
{{#if settingPermissionExpanded }}
<div class="content">
{{> permissionsTable permissions=settingPermissions allRoles=roles collection='Setting'}}
{{# header sectionName=pageTitle}}
<div class="rc-header__section-button">
<a href="{{pathFor"admin-permissions-new"}}"
class="rc-button rc-button--primary new-role">{{_ "New_role"}}</a>
</div>
{{/header}}
<form class="search-form" role="form">
<div class="rc-input__wrapper">
<div class="rc-input__icon">
{{> icon block="rc-input__icon-svg" icon="magnifier" }}
</div>
<input id="permissions-filter" type="text" class="rc-input__element" placeholder="{{_ " Search "}}" autofocus dir="auto">
</div>
</form>

{{>tabs tabs=tabsData}}
{{#if $eq tab 'settings'}}
{{> permissionsTable query=filter permissions=settingPermissions allRoles=roles collection='Setting'}}
{{else}}
{{> permissionsTable query=filter permissions=permissions allRoles=roles collection='Chat'}}
{{/if}}
</section>
{{/if}}
{{#if hasNoPermission}}
<div class="content">
{{#if i18nPageTitle}} {{> header sectionName=i18nPageTitle}} {{else}} {{> header sectionName=pageTitle}}
{{/if}}
{{_ "Not_authorized"}}
</div>
<div class="content">
{{#if i18nPageTitle}} {{> header sectionName=i18nPageTitle}} {{else}} {{> header sectionName=pageTitle}}
{{/if}}
{{_ "Not_authorized"}}
</div>
{{/if}}
</section>
</div>
</template>
</template>
Loading

0 comments on commit 3233371

Please sign in to comment.