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