Skip to main content

RoleMap

Struct RoleMap 

Source
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

Source

pub const MAX_COMMIT: ForgeRole = ForgeRole::Write

The highest role a committer may be given.

Source

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.

Source

pub fn own(&self) -> ForgeRole

Role for git.repo.own.

Source

pub fn maintain(&self) -> ForgeRole

Role for git.repo.maintain. Never ForgeRole::Admin.

Source

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.

Source

pub fn with_committer_write() -> Self

The default map with committers given write — for a repository that opts in to branch-based contribution.

Source

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.

Trait Implementations§

Source§

impl Clone for RoleMap

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RoleMap

Source§

impl Debug for RoleMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RoleMap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RoleMap

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for RoleMap

Source§

impl PartialEq for RoleMap

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RoleMap

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RoleMap

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.