|
|
|
@ -1,6 +1,12 @@
|
|
|
|
|
package com.fanruan.api.decision; |
|
|
|
|
|
|
|
|
|
import com.fr.decision.authority.AuthorityContext; |
|
|
|
|
import com.fr.decision.authority.base.constant.AuthorityStaticItemId; |
|
|
|
|
import com.fr.decision.authority.base.constant.AuthorityValue; |
|
|
|
|
import com.fr.decision.authority.base.constant.type.authority.AuthorityType; |
|
|
|
|
import com.fr.decision.authority.controller.GradeAuthorityController; |
|
|
|
|
import com.fr.decision.authority.data.personnel.DepRole; |
|
|
|
|
import com.fr.decision.webservice.utils.WebServiceUtils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author richie |
|
|
|
@ -13,7 +19,7 @@ public class AuthorityKit {
|
|
|
|
|
/** |
|
|
|
|
* 内置管理系统节点id |
|
|
|
|
*/ |
|
|
|
|
public static class Management{ |
|
|
|
|
public static class Management { |
|
|
|
|
public static final String USER = AuthorityStaticItemId.DEC_MANAGEMENT_USER_ID; |
|
|
|
|
|
|
|
|
|
public static final String AUTHORITY = AuthorityStaticItemId.DEC_MANAGEMENT_AUTHORITY_ID; |
|
|
|
@ -42,4 +48,60 @@ public class AuthorityKit {
|
|
|
|
|
|
|
|
|
|
public static final String MAINTENANCE = AuthorityStaticItemId.DEC_MANAGEMENT_MAINTENANCE_ID; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 给部门职位设置人员管理权限 |
|
|
|
|
* |
|
|
|
|
* @param depostId 部门职位id |
|
|
|
|
* @param authValue 接受/拒绝 |
|
|
|
|
* @param authId 实体id |
|
|
|
|
* @param authType 权限类型 |
|
|
|
|
* @throws Exception 异常 |
|
|
|
|
*/ |
|
|
|
|
public static void setDepAuth(String depostId, int authValue, String authId, int authType) throws Exception { |
|
|
|
|
|
|
|
|
|
DepRole depRole = WebServiceUtils.parseUniqueDepartmentPostId(depostId); |
|
|
|
|
AuthorityContext.getInstance().getAuthorityController(GradeAuthorityController.class).setDepAuthorityValue( |
|
|
|
|
depRole.getDepartmentId(), |
|
|
|
|
depRole.getPostId(), |
|
|
|
|
AuthorityValue.fromInteger(authValue), |
|
|
|
|
authId, |
|
|
|
|
AuthorityType.fromInteger(authType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 给用户设置人员管理权限 |
|
|
|
|
* |
|
|
|
|
* @param userId 用户id |
|
|
|
|
* @param authValue 接受/拒绝 |
|
|
|
|
* @param authId 实体id |
|
|
|
|
* @param authType 权限类型 |
|
|
|
|
* @throws Exception 异常 |
|
|
|
|
*/ |
|
|
|
|
public static void setUserAuth(String userId, int authValue, String authId, int authType) throws Exception { |
|
|
|
|
|
|
|
|
|
AuthorityContext.getInstance().getAuthorityController(GradeAuthorityController.class).setUserAuthorityValue( |
|
|
|
|
userId, |
|
|
|
|
AuthorityValue.fromInteger(authValue), |
|
|
|
|
authId, |
|
|
|
|
AuthorityType.fromInteger(authType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 给角色设置人员管理权限 |
|
|
|
|
* |
|
|
|
|
* @param roleId 角色id |
|
|
|
|
* @param authValue 接受/拒绝 |
|
|
|
|
* @param authId 实体id |
|
|
|
|
* @param authType 权限类型 |
|
|
|
|
* @throws Exception 异常 |
|
|
|
|
*/ |
|
|
|
|
public static void setCustomRoleAuth(String roleId, int authValue, String authId, int authType) throws Exception { |
|
|
|
|
|
|
|
|
|
AuthorityContext.getInstance().getAuthorityController(GradeAuthorityController.class).setCustomAuthorityValue( |
|
|
|
|
roleId, |
|
|
|
|
AuthorityValue.fromInteger(authValue), |
|
|
|
|
authId, |
|
|
|
|
AuthorityType.fromInteger(authType)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|