Merge "PolyGerrit: Hide Audit Log tab from users that are not the group owner"

This commit is contained in:
Wyatt Allen 2017-08-10 19:25:36 +00:00 committed by Gerrit Code Review
commit 1d43efec61

View File

@ -50,6 +50,10 @@
observer: '_computeGroupName',
},
_groupName: String,
_groupOwner: {
type: Boolean,
value: false,
},
_filteredLinks: Array,
_showDownload: {
type: Boolean,
@ -123,16 +127,19 @@
name: this._groupName,
view: 'gr-group',
url: `/admin/groups/${this.encodeURL(this._groupId, true)}`,
children: [
{
name: 'Audit Log',
detailType: 'audit-log',
view: 'gr-group-audit-log',
url: `/admin/groups/${this.encodeURL(this._groupId, true)}` +
',audit-log',
},
],
children: [],
};
if (this._groupOwner) {
linkCopy.subsection.children.push(
{
name: 'Audit Log',
detailType: 'audit-log',
view: 'gr-group-audit-log',
url: `/admin/groups/${this.encodeURL(this._groupId, true)}` +
',audit-log',
}
);
}
}
filteredLinks.push(linkCopy);
}
@ -203,6 +210,13 @@
this.$.restAPI.getGroupConfig(groupId).then(group => {
this._groupName = group.name;
this.reload();
this.$.restAPI.getIsGroupOwner(group.name).then(
configs => {
if (configs.hasOwnProperty(group.name)) {
this._groupOwner = true;
this.reload();
}
});
});
},