peng.peng
1 year ago
12 changed files with 125 additions and 30 deletions
@ -0,0 +1,16 @@ |
|||
create table organization |
|||
( |
|||
id serial |
|||
constraint organization_pk |
|||
primary key, |
|||
name varchar, |
|||
code varchar, |
|||
ability varchar |
|||
); |
|||
|
|||
comment on table organization is '用户机构'; |
|||
|
|||
comment on column organization.ability is '职能'; |
|||
|
|||
create unique index organization_id_uindex |
|||
on organization (id); |
@ -0,0 +1,8 @@ |
|||
alter table t_user |
|||
add "orgId" int; |
|||
|
|||
alter table t_resource_catalog |
|||
add "orgId" int; |
|||
|
|||
alter table t_restful_api |
|||
add catalog int; |
@ -1,13 +1,21 @@ |
|||
'use strict'; |
|||
|
|||
export default class Func { |
|||
static isAuthorized(authcode) { |
|||
if (JSON.parse(sessionStorage.getItem('user'))) { |
|||
const { resources } = JSON.parse(sessionStorage.getItem('user')); |
|||
return resources.includes(authcode); |
|||
}else{ |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
|
|||
export default class Func { |
|||
static isAuthorized(authcode) { |
|||
if (JSON.parse(sessionStorage.getItem('user'))) { |
|||
const { resources } = JSON.parse(sessionStorage.getItem('user')); |
|||
return resources.includes(authcode); |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
static isOrgOrSuperAdmin(id) { |
|||
if (JSON.parse(sessionStorage.getItem('user'))) { |
|||
const { username, orgId } = JSON.parse(sessionStorage.getItem('user')); |
|||
return username == 'SuperAdmin' || orgId == id; |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue