mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-13 02:25:06 +08:00
1.实现了工作流引擎 中 请假流程demo(定义在 resources/leave.bpmn)
2.增加一个一级菜单 OA 办公 下面两个菜单: 请假申请,待办任务 3.暂时不知如何找部门领导, 暂时写死为 admin 4.activity 用户组使用 用户岗位来代替。 5.新增一个用户 hradmin, 密码 123456 岗位是 人力资源 6.演示流程。 a. admin 登陆 申请请假 b. admin 待办任务(审批) c. hradmin 登陆 待办任务(审批) d. admin 登陆 待办任务 (确认)
This commit is contained in:
@ -4,11 +4,10 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 登陆用户信息
|
||||
@ -48,6 +47,18 @@ public class LoginUser implements UserDetails {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 所属岗位
|
||||
*/
|
||||
private Set<Long> postIds;
|
||||
|
||||
/**
|
||||
* group 目前指岗位代替
|
||||
*/
|
||||
private List<String> groups;
|
||||
|
||||
|
||||
@Override
|
||||
@JsonIgnore// 避免序列化
|
||||
public String getPassword() {
|
||||
@ -55,7 +66,6 @@ public class LoginUser implements UserDetails {
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonIgnore
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
@ -69,7 +79,9 @@ public class LoginUser implements UserDetails {
|
||||
@Override
|
||||
@JsonIgnore// 避免序列化
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return null;
|
||||
List<GrantedAuthority> list = new ArrayList<>(1);
|
||||
list.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,13 +90,18 @@ public class SecurityFrameworkUtils {
|
||||
public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) {
|
||||
// 创建 UsernamePasswordAuthenticationToken 对象
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
|
||||
loginUser, null, null);
|
||||
loginUser, null, loginUser.getAuthorities());
|
||||
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
// 设置到上下文
|
||||
//何时调用 SecurityContextHolder.clearContext. spring security filter 应该会调用 clearContext
|
||||
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||
// 额外设置到 request 中,用于 ApiAccessLogFilter 可以获取到用户编号;
|
||||
// 原因是,Spring Security 的 Filter 在 ApiAccessLogFilter 后面,在它记录访问日志时,线上上下文已经没有用户编号等信息
|
||||
WebFrameworkUtils.setLoginUserId(request, loginUser.getId());
|
||||
|
||||
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(loginUser.getUsername());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user