|
|
@@ -31,6 +31,7 @@ import com.zhongshu.card.server.core.domain.org.OrganizationUser;
|
|
|
import com.zhongshu.card.server.core.domain.org.Role;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
+import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
import com.zhongshu.card.server.core.util.AesUtils;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
@@ -73,6 +74,9 @@ public class RoleServiceImpl extends SuperService {
|
|
|
@Autowired
|
|
|
private OrganizationUserDao organizationUserDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrganizationServiceImpl organizationService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 添加/编辑角色
|
|
|
@@ -484,7 +488,14 @@ public class RoleServiceImpl extends SuperService {
|
|
|
* @return
|
|
|
*/
|
|
|
public ResultContent getCurrentUserProjectAuth(String projectOid) {
|
|
|
- Set<String> auths = getUserProjectAllAuths(projectOid, getCurrentUserId());
|
|
|
+ String userId = getCurrentUserId();
|
|
|
+ Set<String> auths = getUserProjectAllAuths(projectOid, userId);
|
|
|
+ // 得到平台的权限
|
|
|
+ Organization organization = organizationService.getPlatForm();
|
|
|
+ Set<String> platFormAuths = getUserOrgAllAuths(organization, userId);
|
|
|
+ if (platFormAuths != null && !platFormAuths.isEmpty()) {
|
|
|
+ auths.addAll(platFormAuths);
|
|
|
+ }
|
|
|
return ResultContent.buildSuccess(AesUtils.encryptAuth(auths));
|
|
|
}
|
|
|
|
|
|
@@ -507,6 +518,23 @@ public class RoleServiceImpl extends SuperService {
|
|
|
return auth;
|
|
|
}
|
|
|
|
|
|
+ public Set<String> getUserOrgAllAuths(Organization organization, String userId) {
|
|
|
+ Set<String> auth = new HashSet<>();
|
|
|
+ if (StringUtils.isEmpty(userId)) {
|
|
|
+ return auth;
|
|
|
+ }
|
|
|
+ UserAccount userAccount = userCountDao.findTopByUserId(userId);
|
|
|
+ if (ObjectUtils.isEmpty(userAccount)) {
|
|
|
+ return auth;
|
|
|
+ }
|
|
|
+ OrganizationUser organizationUser = organizationUserDao.findTopByOrganizationAndUser(organization, userAccount);
|
|
|
+ if (ObjectUtils.isEmpty(organizationUser)) {
|
|
|
+ return auth;
|
|
|
+ }
|
|
|
+ auth.addAll(getOrganizationUserAuths(organizationUser));
|
|
|
+ return auth;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 得到机构用户数据权限
|
|
|
*
|