forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Ozone team member manager (bluesky-social#2460)
* 🚧 Proposal for moderator manager lexicons * ✨ CRUD for moderator management works * ✨ Add profile view to moderator user list * ✨ Seed mod users from env var to db * ✅ Adjust tests * ✅ Update snapshots * ✨ Fix type and lexicon token issues * ✨ Add pagination to listUsers * ✨ Use sort order in pagination * 📝 Change error name * ✅ Update snapshots * ✅ seed mods in sync to avoid re-order * 🧹 Remove unnecessary import * 🐛 Re-run codegen * 🧹 Some cleanup * 🧹 Cleanup unnecessary properties on auth-verifier * ✨ Rename terminologies from moderator to team and member * 🧹 Cleanup * ✨ Allow admin tokens to update/add member * ✨ Delete members in transaction * ✨ Use db transactions and move profile hydration to the service layer * ✅ Add test for addMember endpoint * 🐛 wait on adding admin DID * ✨ Do not allow updating/deleting service owner and always give service owner admin access * 🧹 Cleanup * ✨ Make timestamp columns non null * 🧹 Cleanup * ✨ Update mod role definition in getConfig * ✨ Deletion and update guards * 🐛 don't prefill service did * 📝 Add changeset
- Loading branch information
Showing
50 changed files
with
3,097 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@atproto/dev-env": patch | ||
"@atproto/ozone": patch | ||
"@atproto/api": patch | ||
"@atproto/pds": patch | ||
--- | ||
|
||
Add DB backed team member management for ozone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.team.addMember", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Add a member to the ozone team. Requires admin role.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["did", "role"], | ||
"properties": { | ||
"did": { "type": "string", "format": "did" }, | ||
"role": { | ||
"type": "string", | ||
"knownValues": [ | ||
"tools.ozone.team.defs#roleAdmin", | ||
"tools.ozone.team.defs#roleModerator", | ||
"tools.ozone.team.defs#roleTriage" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "ref", | ||
"ref": "tools.ozone.team.defs#member" | ||
} | ||
}, | ||
"errors": [ | ||
{ | ||
"name": "MemberAlreadyExists", | ||
"description": "Member already exists in the team." | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.team.defs", | ||
"defs": { | ||
"member": { | ||
"type": "object", | ||
"required": ["did", "role"], | ||
"properties": { | ||
"did": { "type": "string", "format": "did" }, | ||
"disabled": { "type": "boolean" }, | ||
"profile": { | ||
"type": "ref", | ||
"ref": "app.bsky.actor.defs#profileViewDetailed" | ||
}, | ||
"createdAt": { "type": "string", "format": "datetime" }, | ||
"updatedAt": { "type": "string", "format": "datetime" }, | ||
"lastUpdatedBy": { "type": "string" }, | ||
"role": { | ||
"type": "string", | ||
"knownValues": ["#roleAdmin", "#roleModerator", "#roleTriage"] | ||
} | ||
} | ||
}, | ||
"roleAdmin": { | ||
"type": "token", | ||
"description": "Admin role. Highest level of access, can perform all actions." | ||
}, | ||
"roleModerator": { | ||
"type": "token", | ||
"description": "Moderator role. Can perform most actions." | ||
}, | ||
"roleTriage": { | ||
"type": "token", | ||
"description": "Triage role. Mostly intended for monitoring and escalating issues." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.team.deleteMember", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Delete a member from ozone team. Requires admin role.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["did"], | ||
"properties": { | ||
"did": { "type": "string", "format": "did" } | ||
} | ||
} | ||
}, | ||
"errors": [ | ||
{ | ||
"name": "MemberNotFound", | ||
"description": "The member being deleted does not exist" | ||
}, | ||
{ | ||
"name": "CannotDeleteSelf", | ||
"description": "You can not delete yourself from the team" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.team.listMembers", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "List all members with access to the ozone service.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"limit": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 100, | ||
"default": 50 | ||
}, | ||
"cursor": { "type": "string" } | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["members"], | ||
"properties": { | ||
"cursor": { "type": "string" }, | ||
"members": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "tools.ozone.team.defs#member" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.team.updateMember", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Update a member in the ozone service. Requires admin role.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["did"], | ||
"properties": { | ||
"did": { "type": "string", "format": "did" }, | ||
"disabled": { "type": "boolean" }, | ||
"role": { | ||
"type": "string", | ||
"knownValues": [ | ||
"tools.ozone.team.defs#roleAdmin", | ||
"tools.ozone.team.defs#roleModerator", | ||
"tools.ozone.team.defs#roleTriage" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "ref", | ||
"ref": "tools.ozone.team.defs#member" | ||
} | ||
}, | ||
"errors": [ | ||
{ | ||
"name": "MemberNotFound", | ||
"description": "The member being updated does not exist in the team" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.