package org.flowable.ui.common.security; import org.fh.util.Jurisdiction; import org.flowable.common.engine.api.FlowableIllegalStateException; import org.flowable.idm.api.User; import org.flowable.ui.common.model.RemoteUser; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import java.util.ArrayList; import java.util.List; /** * 說明:重構流程編輯器獲取用戶資訊 * 作者:FH Admin * from:www.fhadmin.cn */ public class SecurityUtils { private static User assumeUser; private static SecurityScopeProvider securityScopeProvider = new FlowableSecurityScopeProvider(); private SecurityUtils() { } /** * Get the login of the current user. */ public static String getCurrentUserId() { User user = getCurrentUserObject(); if (user != null) { return user.getId(); } return null; } /** * @return the {@link User} object associated with the current logged in user. */ public static User getCurrentUserObject() { if (assumeUser != null) { return assumeUser; } RemoteUser user = new RemoteUser(); user.setId(Jurisdiction.getUsername()); user.setDisplayName(Jurisdiction.getName()); user.setFirstName(Jurisdiction.getName()); user.setLastName(Jurisdiction.getName()); user.setEmail("[email protected]"); user.setPassword("123456"); List<String> pris = new ArrayList<>(); pris.add(DefaultPrivileges.ACCESS_MODELER); pris.add(DefaultPrivileges.ACCESS_IDM); pris.add(DefaultPrivileges.ACCESS_ADMIN); pris.add(DefaultPrivileges.ACCESS_TASK); pris.add(DefaultPrivileges.ACCESS_REST_API); user.setPrivileges(pris); return user; } public static void setSecurityScopeProvider(SecurityScopeProvider securityScopeProvider) { SecurityUtils.securityScopeProvider = securityScopeProvider; } public static SecurityScope getCurrentSecurityScope() { SecurityContext securityContext = SecurityContextHolder.getContext(); if (securityContext != null && securityContext.getAuthentication() != null) { return getSecurityScope(securityContext.getAuthentication()); } return null; } public static SecurityScope getSecurityScope(Authentication authentication) { return securityScopeProvider.getSecurityScope(authentication); } public static SecurityScope getAuthenticatedSecurityScope() { SecurityScope currentSecurityScope = getCurrentSecurityScope(); if (currentSecurityScope != null) { return currentSecurityScope; } throw new FlowableIllegalStateException("User is not authenticated"); } public static void assumeUser(User user) { assumeUser = user; } public static void clearAssumeUser() { assumeUser = null; } }
1.模型管理 :web在線流程設計器、匯入匯出xml、復制流程、部署流程
2.流程管理 :匯入匯出流程資源檔案、查看流程圖、根據流程實體反射出流程模型、激活掛起
3.運行中流程:查看流程資訊、當前任務節點、當前流程圖、作廢暫停流程、指派待辦人、自由跳轉
4.歷史的流程:查看流程資訊、流程用時、流程狀態、查看任務發起人資訊
5.待辦任務 :查看本人個人任務以及本角色下的任務、辦理、駁回、作廢、指派一下代理人
6.已辦任務 :查看自己辦理過的任務以及流程資訊、流程圖、流程狀態(作廢 駁回 正常完成)
辦理任務時候可以選擇用戶進行抄送,就是給被抄送人發送站內信通知當前審批意見以及備注資訊
注:當辦理完當前任務時,下一任務待辦人會即時通訊收到新任務訊息提醒,當作廢和完結任務時,
任務發起人會收到站內信訊息通知
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/421301.html
標籤:Java
