Skip to content

Commit

Permalink
Add path to permission title
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimpson committed Nov 19, 2017
1 parent 8523456 commit c87a30d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 13 additions & 1 deletion packages/rocketchat-authorization/client/views/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ Template.permissionsTable.helpers({
},

permissionName(permission) {
return permission.level === permissionLevel.SETTING ? t(permission.settingId) : t(permission._id);
if (permission.level === permissionLevel.SETTING) {
let path = '';
if (permission.group) {
path = `${ t(permission.group) } > `;
}
if (permission.section) {
path = `${ path }${ t(permission.section) } > `;
}
path = `${ path }${ t(permission.settingId) }`;
return path;
} else {
return t(permission._id);
}
},

permissionDescription(permission) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Meteor.methods({
const records = RocketChat.models.Permissions.find({
level: permissionLevel.SETTING,
groupPermissionId: {$exists: true} //filter group permissions themselves, as they are being assigned implicitly
}).fetch();
}, {}, {sort:{group: 1, section: 1}}).fetch();

if (updatedAt instanceof Date) {
return {
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-authorization/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ Meteor.startup(function() {
const permission = {
_id: permissionId,
level: permissionLevel.SETTING,
settingId: setting._id
settingId: setting._id,
group: setting.group,
section: setting.section
};
// copy previously assigned roles if available
if (previousSettingPermissions[permissionId] && previousSettingPermissions[permissionId].roles) {
Expand Down

0 comments on commit c87a30d

Please sign in to comment.