You've already forked agentic-coding-workflow
修改
This commit is contained in:
@@ -22,6 +22,7 @@ type User struct {
|
||||
Email string
|
||||
DisplayName string
|
||||
IsAdmin bool
|
||||
Enabled bool
|
||||
PasswordHash string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
@@ -58,4 +59,33 @@ type Service interface {
|
||||
Bootstrap(ctx context.Context, email, password string) (*User, error)
|
||||
// ListAdmins 返回所有管理员用户,供内部模块(如 jobs runner)使用。
|
||||
ListAdmins(ctx context.Context) ([]*User, error)
|
||||
|
||||
// ===== 管理员用户管理(需调用方自行做 admin 鉴权)=====
|
||||
|
||||
// ListUsers 返回全部用户,按创建时间升序,供管理后台展示。
|
||||
ListUsers(ctx context.Context) ([]*User, error)
|
||||
// CreateUser 由管理员创建一个新账号。email 唯一冲突时返回 CodeConflict。
|
||||
CreateUser(ctx context.Context, in CreateUserInput) (*User, error)
|
||||
// UpdateProfile 修改用户的 display_name。
|
||||
UpdateProfile(ctx context.Context, id uuid.UUID, displayName string) (*User, error)
|
||||
// SetAdmin 设置用户的管理员标志。降级最后一个启用管理员时返回 CodeConflict;
|
||||
// actor==target 且降级自身时返回 CodeConflict(防自锁)。
|
||||
SetAdmin(ctx context.Context, actor, target uuid.UUID, isAdmin bool) (*User, error)
|
||||
// SetEnabled 启用/禁用用户。禁用会撤销其全部会话。禁用最后一个启用管理员或
|
||||
// 禁用自身时返回 CodeConflict。
|
||||
SetEnabled(ctx context.Context, actor, target uuid.UUID, enabled bool) (*User, error)
|
||||
// AdminResetPassword 由管理员重置目标用户密码,返回一次性明文临时密码并撤销其会话。
|
||||
AdminResetPassword(ctx context.Context, id uuid.UUID) (tempPassword string, err error)
|
||||
// ChangePassword 用户自助改密:校验旧密码后更新,并撤销其它会话。
|
||||
ChangePassword(ctx context.Context, id uuid.UUID, oldPassword, newPassword string) error
|
||||
// DeleteUser 删除用户。删除最后一个启用管理员或删除自身时返回 CodeConflict。
|
||||
DeleteUser(ctx context.Context, actor, target uuid.UUID) error
|
||||
}
|
||||
|
||||
// CreateUserInput 是管理员创建用户的入参。
|
||||
type CreateUserInput struct {
|
||||
Email string
|
||||
DisplayName string
|
||||
Password string
|
||||
IsAdmin bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user