pub struct RoleMap { /* private fields */ }Expand description
Which forge role each repository tier asks for, before the forge’s ladder is applied (§4.2’s “GitHub projection (org)” column is the default).
This is the community hook of §5.8 layer 3: a bridge, a namespace or a
repository may override the map (maintain → write on Forgejo instead of
write plus the merge allow-list, or committers get write on a
repository that opts in to branch-based contribution) without code.
There is no entry for git.ns.admin, by design (decided 2026-09-25):
a namespace admin gets no forge role, so no map can give them one. An
nsAdmin key is refused when a map is read.
A map is always ordered — own ≥ maintain ≥ commit — and only own
may map to ForgeRole::Admin (git-ns/bridge/job 0.4): maintain
and commit are rights their holder may grant themselves, so either at
admin would let someone make themselves an administrator of the
repository on the forge on their own authority. A committer gets at most
write: the check, not the forge role, decides whose commits land, and a
committer with merge rights would be a maintainer. RoleMap::new and
deserialisation both enforce this, and the fields are private so that no
map can be changed afterwards to one they would refuse.
Implementations§
Source§impl RoleMap
impl RoleMap
Sourcepub const MAX_COMMIT: ForgeRole = ForgeRole::Write
pub const MAX_COMMIT: ForgeRole = ForgeRole::Write
The highest role a committer may be given.
Sourcepub fn new(
own: ForgeRole,
maintain: ForgeRole,
commit: ForgeRole,
) -> Result<Self, String>
pub fn new( own: ForgeRole, maintain: ForgeRole, commit: ForgeRole, ) -> Result<Self, String>
A map giving own, maintain and commit to the three tiers.
Refused unless own ≥ maintain ≥ commit, maintain is below
admin and commit ≤ write.
Sourcepub fn maintain(&self) -> ForgeRole
pub fn maintain(&self) -> ForgeRole
Role for git.repo.maintain. Never ForgeRole::Admin.
Sourcepub fn commit(&self) -> ForgeRole
pub fn commit(&self) -> ForgeRole
Role for git.commit.sign. None by default: committers contribute
through fork PRs, and the required check — not a forge role — decides
whether their commits land. At most RoleMap::MAX_COMMIT.
Sourcepub fn with_committer_write() -> Self
pub fn with_committer_write() -> Self
The default map with committers given write — for a repository that
opts in to branch-based contribution.
Sourcepub fn requested(&self, rights: EffectiveRights) -> ForgeRole
pub fn requested(&self, rights: EffectiveRights) -> ForgeRole
The role the rights ask for, before any ladder is applied. Only
repository rights granted in their own name count
(EffectiveRights::forge_tier): ns.admin alone asks for
ForgeRole::None.