Skip to content

Commit

Permalink
update ui
Browse files Browse the repository at this point in the history
  • Loading branch information
penggy committed Mar 4, 2021
1 parent 165cf21 commit 0b37ba1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion web_src/components/AdminLTE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,20 @@ Vue.prototype.canTalk = () => {
return location.protocol.indexOf("https") == 0 || location.hostname === 'localhost' || location.hostname === '127.0.0.1';
}
Vue.prototype.hasAnyRole = (serverInfo, userInfo, ...roles) => {
roles = roles||[];
if (serverInfo && serverInfo.APIAuth === false && !userInfo) {
if(roles.length == 1 && roles[0] == '管理员') {
return false;
} else {
return true;
}
}
var userRoles = [];
if (userInfo) {
userRoles = userInfo.Roles || [];
}
var checked = false;
for(var role of (roles||[])) {
for(var role of roles) {
if (!role || userRoles.some(ur => (ur == role || ur == '超级管理员'))) {
checked = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion web_src/components/Sider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
if(item.versionType && item.versionType != this.serverInfo.VersionType) {
return false;
}
if(item.roles && !this.hasAnyRole(this.serverInfo, this.userInfo, ...item.roles)) {
if(item.roles && this.userInfo && !this.hasAnyRole(this.serverInfo, this.userInfo, ...item.roles)) {
return false;
}
if(item.path == "/about" && this.serverInfo.ShowAbout === false) {
Expand Down

0 comments on commit 0b37ba1

Please sign in to comment.