实现租户、成员与认证

Open
#11 0 comments 0 reactions 0 assignees View on GitHub

@linuxsuren-fs is already working on this.

Since Nov 14, 2026.

  • #22 by @linuxsuren-fs — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
1/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
sql

Research direction

Start with the schema, endpoint, and isolation designs in issues #2, #3, and #6, then inspect the middleware and project structure from dependency #8. The issue calls for users, tenants, and tenant_members migrations and repositories, authentication and member endpoints, integration tests, and an OpenAPI update. Done means the listed flows and permission cases pass, including single-use setup and invitation tokens and cross-tenant 404 responses.

Written by the indexing model from the issue text.

Description

help wanted P0

Background

多租户平台的账户与组织基座。设计见 #2(表)、#3(端点)、#6(隔离与权限)。本 issue 实现租户、成员与认证全流程。

Technical requirement

  • 认证:POST /api/auth/setup(仅系统为空时可用)、POST /api/auth/login(返回 token + 可加入租户列表)、POST /api/auth/select-tenant(换发租户 token)、GET /api/me;
  • 密码 bcrypt 哈希;JWT 含 sub / tenant / role,有效期 24h;
  • 成员管理:列表(分页契约)、邀请(邮箱 + 角色 → 创建账号 + 一次性设置密码邀请 token,单次有效且过期)、变更角色、移除成员;
  • 租户信息:GET /api/tenants/current(含品牌)、PATCH /api/tenants/current(tenant_admin);
  • 新租户创建时自动导入种子模板包(机制实现,种子内容来自 #19,先允许为空);
  • 错误码遵循 #3:登录失败 UNAUTHORIZED、越权 FORBIDDEN、跨租户 NOT_FOUND。

Expect

  • 集成测试覆盖:setup 一次性、登录 / 换租户、邀请 token 单次有效、权限矩阵(#6 逐格)、跨租户访问一律 404;
  • docs/openapi.yaml 同步更新。

Potential TODO list

  • users / tenants / tenant_members 迁移与 repository(含 scope)
  • setup / login / select-tenant / me 端点
  • 成员邀请与设置密码流程
  • 租户品牌读写
  • 集成测试

依赖

#8(骨架与中间件)。

Dominant language
No language data
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LinuxSuRen/tick-flow

All issues in LinuxSuRen/tick-flow

Similar issues

More Security issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.