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 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 findByUsername(String username); Optional findById(Long id); List findAll(); // Token 相关 UserTokenDTO createToken(Long userId, long expireMs); void removeToken(String token); boolean isValidToken(String token); Optional findToken(String token); // 用户角色 List listUserRoles(Long userId); boolean addUserRole(Long userId, Long roleId); boolean removeUserRole(Long userId, Long roleId); // 用户特殊授权 List listUserFiles(Long userId); boolean addUserFileAuth(Long userId, Long fileId); boolean removeUserFileAuth(Long userId, Long fileId); // 角色 List listRoles(); Optional getRoleById(Long roleId); boolean addRole(RoleDTO role); boolean updateRole(RoleDTO role); boolean deleteRole(Long id); // 角色授权信息 List listRoleFileRules(Long roleId); List listAllRules(); boolean addRoleFileRule(RoleFileRuleDTO rule); boolean removeRoleFileRule(Long id); }