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; } }
?-----------------------------------------------------------------自定義表單
28. 定義模版:拖拽左側表單元素到右側區域,編輯表單元素,保存表單模版
29. 表單模版:編輯維護表單模版,復制表單模版,修改模版型別,預覽表單模版
30. 我的表單:選擇表單模版,編輯表單規則,是否上傳圖片、附件、開啟富文本、掛靠流程開關等
31. 表單資料:從我的表單進去可增刪改查表單資料,修改表單規則
32. 掛靠記錄:記錄表單資料和流程實體ID關聯記錄,可洗掉
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/466068.html
標籤:其他
上一篇:我的微服務總結
