管理员权限bug修复
This commit is contained in:
parent
1c5e568e5b
commit
c08de3102b
@ -55,6 +55,9 @@ public class PermissionEvaluator {
|
||||
*/
|
||||
public boolean hasCompanySnAccess(String sn) {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
if (user.getAccountType().equals(SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||
return true;
|
||||
}
|
||||
if (user.getAccountType().equals(SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
|
||||
return companyService.hasCompanySnAccessBy1(user.getUserId(), sn);
|
||||
} else if (user.getAccountType().equals(SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue())) {
|
||||
@ -74,6 +77,10 @@ public class PermissionEvaluator {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasCompanyIdAccess(String companyId) {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
if (user.getAccountType().equals(SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||
return true;
|
||||
}
|
||||
Company company = companyService.getById(companyId);
|
||||
if (company == null) {
|
||||
return false;
|
||||
@ -92,6 +99,9 @@ public class PermissionEvaluator {
|
||||
if (user == null) {
|
||||
return false;
|
||||
}
|
||||
if (user.getAccountType().equals(SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||
return true;
|
||||
}
|
||||
int c = companyService.count(new LambdaQueryWrapper<Company>()
|
||||
.eq(Company::getCompanySn, sn));
|
||||
if (c > 0) {
|
||||
@ -109,6 +119,9 @@ public class PermissionEvaluator {
|
||||
*/
|
||||
public boolean hasProjectSnAccess(String projectSn) {
|
||||
UserInfo owner = SecurityUtils.getUser();
|
||||
if (owner.getAccountType().equals(SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||
return true;
|
||||
}
|
||||
if (owner.getAccountType().equals(SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
|
||||
return companyService.hasProjectSnAccessBy1(owner.getUserId(), projectSn);
|
||||
} else if (owner.getAccountType().equals(SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue())) {
|
||||
@ -134,8 +147,11 @@ public class PermissionEvaluator {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasUserAccess(String userId) {
|
||||
SystemUser checkUser = systemUserService.getById(userId);
|
||||
UserInfo owner = SecurityUtils.getUser();
|
||||
if (owner.getAccountType().equals(SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||
return true;
|
||||
}
|
||||
SystemUser checkUser = systemUserService.getById(userId);
|
||||
Integer checkAccountType = checkUser.getAccountType();
|
||||
Integer ownerAccountType = owner.getAccountType();
|
||||
if (isCompanyType(checkAccountType)) {
|
||||
@ -234,6 +250,10 @@ public class PermissionEvaluator {
|
||||
* @return 是否有权限
|
||||
*/
|
||||
public boolean hasIdAccess(String entityClassName, String snFieldName, String id) {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
if (user.getAccountType().equals(SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||
return true;
|
||||
}
|
||||
if (StringUtils.isBlank(entityClassName) || StringUtils.isBlank(snFieldName) || id == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user