feat(api): enforce roles, org sign-in policies, invitations and api tokens
Every org route resolves a principal from the session or a bearer token and checks a permission. Nobody can grant, revoke or remove more than they hold. Tokens are capped by their owner's current rights and cannot manage credentials. Orgs can require TOTP or SSO; the owner keeps a password fallback for SSO. Closes #6 Closes #7 Closes #8 Closes #9 Closes #41 Closes #45 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
30409697f7
commit
d7d4821e3e
24 files changed
+4677
-439
No files matched your search
@@ -171,6 +171,12 @@ func (s *Server) totpEnable(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
_ = s.rdb.Del(ctx, totpSetupKey(sess.UserID)).Err()
|
||||
if sess.Method == auth.MethodPassword || sess.Method == "" {
|
||||
if err := s.sessions.SetMethod(ctx, sess, auth.MethodPasswordTOTP); err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"recovery_codes": codes})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user