agents get read, not write, on their own agent-configs repo; an existing grant is left alone
This commit is contained in:
parent
144d958208
commit
07c66e3a1c
1 changed files with 35 additions and 41 deletions
|
|
@ -524,17 +524,6 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
/// Add `user` as a collaborator on `CONFIG_ORG/repo` at `permission`.
|
||||
async fn add_collaborator(
|
||||
&self,
|
||||
repo: &str,
|
||||
user: &str,
|
||||
permission: AddCollaboratorOptionPermission,
|
||||
) -> Result<()> {
|
||||
self.add_collaborator_to(CONFIG_ORG, repo, user, permission)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Add `user` as a collaborator on `owner/repo` at `permission`.
|
||||
/// Idempotent: re-adding an existing collaborator just updates its
|
||||
/// permission (forgejo answers 204 either way; a 201 from older
|
||||
|
|
@ -720,12 +709,14 @@ impl Client {
|
|||
Ok(true)
|
||||
}
|
||||
|
||||
/// Add `agent` as a **write** collaborator on `repo` (can push + open
|
||||
/// PRs, cannot bypass branch protection) — the whole job of the
|
||||
/// `AddRepoMember` node. Idempotent.
|
||||
/// Add `agent` as a **read** collaborator on `repo` — the whole job of the
|
||||
/// `AddRepoMember` node. Read is enough: the agent clones its config and
|
||||
/// proposes a change through an `AGit` pull request, which needs no push
|
||||
/// access. Idempotent, and it leaves a grant of read or more as it is, so a
|
||||
/// write grant an operator made, or one made before this node granted
|
||||
/// read, is never lowered.
|
||||
pub async fn add_repo_member(&self, repo: &str, agent: &str) -> Result<()> {
|
||||
self.add_collaborator(repo, agent, AddCollaboratorOptionPermission::Write)
|
||||
.await
|
||||
self.grant_read(CONFIG_ORG, repo, agent).await
|
||||
}
|
||||
|
||||
/// Ensure `agent` exists as a Forgejo user account that cannot create
|
||||
|
|
|
|||
Loading…
Reference in a new issue