57 lines
2.0 KiB
Java
57 lines
2.0 KiB
Java
package com.knowledge.base.application.service;
|
|
|
|
import com.knowledge.base.infrastructure.north.dto.role.RoleDTO;
|
|
import com.knowledge.base.infrastructure.north.dto.role.RoleFileRuleDTO;
|
|
import com.knowledge.base.infrastructure.north.dto.role.UserRoleDTO;
|
|
import com.knowledge.base.infrastructure.north.dto.user.UserDTO;
|
|
import com.knowledge.base.infrastructure.north.dto.user.UserFileDTO;
|
|
import com.knowledge.base.infrastructure.north.dto.user.UserTokenDTO;
|
|
|
|
import java.util.List;
|
|
import java.util.Optional;
|
|
|
|
public interface UserAppService {
|
|
// 用户注册
|
|
boolean registerUser(String username, String password, List<Long> roleIds);
|
|
boolean verifyPassword(String username, String plainText);
|
|
boolean changePassword(Long userId, String oldPassword, String newPassword);
|
|
boolean deleteUser(Long id);
|
|
boolean updateUser(Long id, UserDTO userDTO);
|
|
|
|
// 用户资料
|
|
Optional<UserDTO> findByUsername(String username);
|
|
Optional<UserDTO> findById(Long id);
|
|
List<UserDTO> findAll();
|
|
|
|
// Token 相关
|
|
UserTokenDTO createToken(Long userId, long expireMs);
|
|
void removeToken(String token);
|
|
boolean isValidToken(String token);
|
|
Optional<UserTokenDTO> findToken(String token);
|
|
|
|
// 用户角色
|
|
List<UserRoleDTO> listUserRoles(Long userId);
|
|
boolean addUserRole(Long userId, Long roleId);
|
|
boolean removeUserRole(Long userId, Long roleId);
|
|
|
|
// 用户特殊授权
|
|
List<UserFileDTO> listUserFiles(Long userId);
|
|
boolean addUserFileAuth(Long userId, Long fileId);
|
|
boolean removeUserFileAuth(Long userId, Long fileId);
|
|
|
|
// 角色
|
|
List<RoleDTO> listRoles();
|
|
Optional<RoleDTO> getRoleById(Long roleId);
|
|
boolean addRole(RoleDTO role);
|
|
boolean updateRole(RoleDTO role);
|
|
boolean deleteRole(Long id);
|
|
|
|
// 角色授权信息
|
|
List<RoleFileRuleDTO> listRoleFileRules(Long roleId);
|
|
|
|
List<RoleFileRuleDTO> listAllRules();
|
|
boolean addRoleFileRule(RoleFileRuleDTO rule);
|
|
boolean removeRoleFileRule(Long id);
|
|
|
|
}
|