60 Commits

Author SHA1 Message Date
seaislee1209
a455753fdc fix: scheduler now refreshes last 3 months billing
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m35s
Volcengine bill data has 1-2 day delay. Previously the scheduler
only refreshed current month, so when the month rolls over the
previous month's incomplete snapshot was frozen. Now it refreshes
the current month plus 2 prior months.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 18:20:40 +08:00
seaislee1209
d0a97c3dbe fix: nginx upstream backend -> airgate-backend (k8s service name)
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 57s
The K8s Service is named 'airgate-backend', not 'backend',
causing CrashLoopBackOff with 'host not found in upstream'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:33:50 +08:00
seaislee1209
c28153af1b chore: align online encryption key with local
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m42s
To enable migrating local SQLite database to online deployment,
the AIRGATE_ENCRYPTION_KEY must match between environments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:05:07 +08:00
seaislee1209
2f12f9065e Merge branch 'templocal' into airlabs
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m55s
2026-05-07 11:38:24 +08:00
zyc
f3a3f88b27 ci: migrate deployment to Volcano Engine CR/K3s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m39s
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 10:11:48 +08:00
seaislee1209
236e082349 ui: show project names in IAMUserList instead of count
Display project name tags (green=monitoring, grey=not) with a
'manage' link to the policy page. Much more informative at a glance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 22:09:57 +08:00
seaislee1209
9e81717e08 feat: switch feishu alerts from Webhook to App (private message)
- Replace Webhook with App ID + App Secret + mobile number
- Reuse AirDrama's feishu app (send private card messages)
- Add test button in system settings
- Add test-feishu API endpoint
- Default monitor interval changed to 60 seconds
- Token caching for feishu tenant_access_token

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:56:01 +08:00
seaislee1209
6b3a0bda34 fix: sync removes users that no longer exist on Volcengine
- Track all Volcengine usernames during sync
- Delete local users not found on Volcengine (cascade deletes related data)
- Report removed users in sync response
- Deleted test_audit and tudouceshi from local DB

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:45:14 +08:00
seaislee1209
610058ae5f feat: switch billing to ListSplitBillDetail for accurate project spending
- BillingService now uses ListSplitBillDetail (split bill) instead of
  ListBillDetail (bill detail) - the latter shows Project='-' for
  Seedance pay-as-you-go products
- Added get_spending_all_projects() for batch query (avoids N+1 API calls)
- Scheduler optimized: single API call fetches all project spending
- Verified: amounts match Volcengine console split bill page exactly
- Updated research report with billing API findings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:42:08 +08:00
seaislee1209
294a0885ff docs: update operation guide, changelog, and research report
- Rewrite 操作说明.md with full admin/sub-account operation flow
- Add v0.5.0 to 版本管理.md (permission refactor + account enhancements)
- Add Scope=Project API limitation finding to research report

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 02:06:00 +08:00
seaislee1209
9f00e6996b feat: add Deny policy exempt toggle for admin sub-accounts
- New deny_policy_exempt field on IAMUser model
- Toggle in monitoring config dialog
- Exempt accounts skip Deny policy creation
- Changing the toggle immediately updates/removes Deny policy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 00:01:35 +08:00
seaislee1209
5b997bc1a7 fix: restore volcProjects for create dialog (was removed during cleanup)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:44:34 +08:00
seaislee1209
6f4d7e6b5b fix: refresh ALL users' Deny policies on project changes
When a project is added/removed for any user, all users' Deny
policies must be updated - new projects need to be added to other
users' deny lists to prevent unauthorized cross-project access.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:29:54 +08:00
seaislee1209
d7b40beff7 fix: Volcengine API does not support project-level policy scope
AttachUserPolicy ignores Scope=Project parameter - policies always
attach globally. Project isolation now relies entirely on Deny policy
(AirGate_Deny_{username}) which blocks access to non-whitelisted projects.

Updated report with this finding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:21:08 +08:00
seaislee1209
765c80a47a fix: project policy update compares against Volcengine actual state
Was comparing against local DB which could be stale.
Now queries Volcengine for actual project-level policies before diffing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:10:13 +08:00
seaislee1209
c4c6a03f61 refactor: remove old project/policy dialogs from IAMUserList
All project management and policy operations now handled in the
unified UserPoliciesView page. Removed unused dialogs, variables,
and functions from IAMUserList.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:07:16 +08:00
seaislee1209
dacc521c1c feat: integrate project management into unified policy page
- Add project section: add/remove projects with policy selection
- Each project card shows: policies, spending, monitor toggle, remove
- Replaces separate project management dialog
- All project and policy operations on one page

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:53:18 +08:00
seaislee1209
fab4765e90 fix: remove duplicate @api_view decorator on policies_overview_view
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:47:59 +08:00
seaislee1209
4b8181b96a feat: unified policy overview page for sub-accounts
- New page: /iam-users/:id/policies shows all policies in one view
- Separated into global policies and per-project policies sections
- Each section has inline add/remove with disabled duplicates
- Backend: new policies/overview/ endpoint returns global + project policies
- Replaces old popup-based policy management

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:45:04 +08:00
seaislee1209
9ffa13f44d fix: separate global and project-level policies in frontend display
- Global policy view: filter out project-scoped policies, only show Global
- Project list view: filter out global policies, only show Project-scoped
- Fixes: same policy appearing in both global and project views

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:41:35 +08:00
seaislee1209
d0d48ceb19 fix: add Scope=Project to project-level policy attach/detach
Without Scope parameter, AttachUserPolicy defaults to Global scope
even when ProjectName is provided. Adding Scope=Project ensures
policies are correctly limited to the specified project.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:39:24 +08:00
seaislee1209
23ec78e83d fix: save/restore policies with correct scope (global vs project-level)
- Disable now saves both global and project-level policies with scope info
- Restore puts policies back in original scope (global or project)
- Project list view now syncs policies from Volcengine in real-time
- Fixes: policies incorrectly restored as global after disable/enable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:31:24 +08:00
seaislee1209
a2a822a889 ui: clarify global vs project-level policies in frontend
- Rename "权限策略" to "全局权限策略" in dropdown menu
- Add info banner explaining global vs project-level in both dialogs
- Disable already-attached policies in global dropdown (grey out)
- Show policy type as tag (系统/自定义) in global policies table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:25:29 +08:00
seaislee1209
4e62f3f32e fix: rebuild Deny policy on account restore
Deny policy (AirGate_Deny_{username}) was removed during disable
but not recreated on restore. Now _update_deny_policy is called
during restore to rebuild project isolation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:15:19 +08:00
seaislee1209
413977361a fix: restore preserves pre-disable Volcengine login state
- Save volc_login_allowed state before disable
- Restore to original state (not always open)
- e.g. login=off before disable -> still off after restore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:11:48 +08:00
seaislee1209
bae68ea6a1 fix: sync disable/enable state correctly
- Disable: sync volc_login_allowed=False
- Enable: sync volc_login_allowed from actual LoginProfile state
- Sync: check AK status to detect AirGate-disabled accounts
  (all AKs inactive = disabled, even if user Status=active)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:09:14 +08:00
seaislee1209
9cfd550485 fix: sync separates account status from console login status
- Account status now comes from Volcengine User.Status field (active/disabled)
- Console login status synced to volc_login_allowed separately
- Fixes: closing Volcengine login no longer marks account as disabled after sync
- Handles ghost LoginProfile (CreateDate=1970) correctly during sync

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 21:59:39 +08:00
seaislee1209
40655d63e0 fix: detect ghost LoginProfile from Volcengine (CreateDate=1970)
Users created without console password have a phantom LoginProfile
that GetLoginProfile returns but UpdateLoginProfile/DeleteLoginProfile
reject. Now checking CreateDate to detect this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 21:40:06 +08:00
seaislee1209
92172c6ec8 fix: handle missing LoginProfile in disable/enable/edit
- Skip LoginProfile operations when user has no console password
- Only send non-empty fields to Volcengine UpdateUser API
- Fixes enable_user crash for users created without password

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 21:15:05 +08:00
seaislee1209
ff0d0de8f8 fix: deny policy audit - detach before delete, fail on empty project list
- Fix: detach policy before deleting (avoids deletion error on referenced policy)
- Fix: fail explicitly if project list can't be fetched (prevent no-op Deny)
- Add _refresh_all_deny_policies helper for batch refresh after new project creation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 20:34:19 +08:00
seaislee1209
0f034b7b26 feat: auto-manage Deny policy for project isolation
- Add upsert_deny_policy / remove_deny_policy to IAMService
- Auto-update Deny policy when adding/removing projects
- Auto-create Deny policy on sub-account creation
- Deny policy lists all non-authorized projects explicitly
- Verified: cross-project ListAssetGroups and ListApiKeys are blocked
- Updated research report with cross-project API findings (2026-03-28)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 20:30:56 +08:00
seaislee1209
48c55765c8 feat: add toggle Volcengine console login button for sub-accounts
- Add volc_login_allowed field to IAMUser model
- Add toggle-volc-login API endpoint
- Add toggle button in IAMUserList dropdown menu
- Sync status on user creation and toggle

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 19:38:39 +08:00
seaislee1209
f79ae0084d fix: show clear error when Volcengine console password is too weak
- Detect InvalidPassword error and return user-friendly message
- Rollback user creation if password policy fails
- Add password requirements hint in create form

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 19:27:36 +08:00
seaislee1209
8b49d49048 feat: add edit sub-account profile + verify all password features
- Add edit profile (display name, phone, email) with Volcengine sync
- Add IAMService.update_user for Volcengine UpdateUser API
- Add edit-profile API endpoint and URL
- Add Edit Profile dialog in IAMUserList frontend
- Verify admin change password, sub-account change password, set login password all working

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 15:57:02 +08:00
zyc
002372aa05 fix build bug
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m32s
2026-03-23 09:53:09 +08:00
zyc
5783098fa2 fix bug
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 1m9s
2026-03-23 09:45:08 +08:00
seaislee1209
b25641cfc6 docs: rewrite operations guide with admin/sub-account sections
- Admin section: full workflow from account creation to key entry
- Sub-account section: login, view keys, change password, use API
- Updated for manual key entry mode and no-console-login architecture
- Added alert/auto-disable mechanism description

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:51:45 +08:00
seaislee1209
fac5e1b541 feat: password management for admin and sub-accounts
- Admin: set sub-account AirGate login password via dropdown menu
- Admin: toggle sub-account login enabled/disabled
- Sub-account: change own password (sidebar "修改密码")
- Sub-account: auto-redirect to login page after password change

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:54:35 +08:00
seaislee1209
33c8963d46 fix: add explicit role field to admin login response
Makes auth role logic consistent between admin (role: 'admin')
and sub-account (role: 'iam_user') logins.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 01:35:35 +08:00
seaislee1209
3d2b332657 feat: add sub-account portal (login + my keys view)
- Login page: toggle between admin/sub-account login
- Auth store: isAdmin/isIamUser computed properties
- MainLayout: role-based sidebar (admin sees all, sub-account sees only my keys)
- HomeRedirect: auto-redirect based on role
- MyKeysView: sub-account can view/reveal their own API Keys
- Portal is completely isolated from admin functions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 01:33:02 +08:00
seaislee1209
daa82aee76 feat: add sub-account login to AirGate
- IAMUser model: login_password_hash + login_enabled fields
- Custom JWT auth for sub-accounts (role: iam_user)
- Login/me/my-keys/reveal endpoints for sub-accounts
- Admin can set login password via set-login endpoint
- Sub-accounts can only see their own API Keys

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 01:30:35 +08:00
seaislee1209
7feb007f57 feat: rewrite API Key management as manual entry mode
- New ArkApiKey model (encrypted storage, bound to user+project)
- Admin enters API Key from Volcengine console into AirGate
- Sub-accounts can only view their own keys
- Reveal endpoint decrypts key on demand with audit log
- Updated research report: documented Ark API limitation (CreateApiKey
  doesn't return plaintext) and manual entry solution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 01:25:12 +08:00
seaislee1209
0ac2ef1f27 feat: add Ark API Key management (list/create/toggle/delete)
- New VolcengineClient.call_json() for POST+JSON signing (Ark API)
- ArkService for API Key CRUD operations
- Backend views: list/create/toggle/delete ark keys per project
- Frontend: ArkKeysView with project selector, key table, create dialog
- Created key value shown once with copy button

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 21:36:13 +08:00
seaislee1209
8e564ed640 docs: major report update - AirGate as sole entry point for sub-accounts
Key changes:
- Architecture upgraded: sub-accounts do NOT log into Volcengine console
- Documented Ark API Key management via POST+JSON (verified working)
- Added chapter 12 (Ark API Key mgmt) and 13 (实测发现 with decisions)
- Fixed Step 1 code example to NOT create console login
- Updated core requirements table, architecture diagram, limitations
- All findings verified through actual API testing on 2026-03-20

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 20:36:07 +08:00
seaislee1209
314612f454 feat: add ArkExperienceAccess to policy options
Required for sub-accounts to manage API Keys in Ark console.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 19:52:34 +08:00
seaislee1209
c58fe56d89 feat: add project-level policy management (add/remove per project)
- Add "授权" button on each linked project row
- New dialog to select/deselect policies per project
- Backend does incremental diff: only attach new, detach removed
- Handle PolicyAttachConflict gracefully

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 19:28:14 +08:00
seaislee1209
6dd3ac5c0d fix: handle PolicyAttachConflict when adding project policies
Global policies conflict with project-level attach - treat as success
since the user already has the permission globally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 19:20:07 +08:00
zyc
cc8a91995d Add K8s
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 1m11s
2026-03-20 18:35:53 +08:00
seaislee1209
cbc19a6d9e feat: add admin management, change password, and operation log
- Change password: current user can change their own password
- Admin management: superuser can create/toggle/reset-password for admins
- Operation log: view all system operations with type filter
- All operations are recorded to AlertRecord for audit trail

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:20:14 +08:00
seaislee1209
a7e030dc57 feat: auto-authorize policies when adding projects to sub-accounts
- Disable now removes all policies (saved to DB) + Enable restores them
- Project add: policies are now user-selected (checkbox), not auto-attached
- Fix serializer allow_blank for optional fields (email/phone/password)
- Better error reporting for policy detach/attach failures
- Handle duplicate user creation with clear error message

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 15:01:18 +08:00