Crate guts_auth

Crate guts_auth 

Source
Expand description

Authorization and governance for Guts.

This crate provides:

  • Permissions: Granular access control (Read, Write, Admin)
  • Organizations: Multi-user repository ownership
  • Teams: Group-based permission management
  • Collaborators: Direct repository access grants
  • Branch Protection: Rules for protecting important branches
  • Webhooks: Event notifications for CI/CD integration

§Example

use guts_auth::{AuthStore, Permission, OrgMember, OrgRole};

// Create a store
let store = AuthStore::new();

// Create an organization
let org = store.create_organization(
    "acme".into(),
    "Acme Corporation".into(),
    "owner_pubkey".into(),
).unwrap();

// Create a team with write access
let team = store.create_team(
    org.id,
    "backend".into(),
    Permission::Write,
    "owner_pubkey".into(),
).unwrap();

// Add a member to the team
store.add_team_member(team.id, "developer_pubkey".into()).unwrap();

// Add a repository to the team
store.add_team_repo(team.id, "acme/api".into()).unwrap();

// Check permissions
assert!(store.check_permission("developer_pubkey", "acme/api", Permission::Write));

Structs§

AuthStore
Thread-safe in-memory store for authorization data.
BranchProtection
Branch protection rule for a repository.
BranchProtectionRequest
Request to create or update branch protection.
Collaborator
A collaborator on a repository.
CollaboratorRequest
Request to add or update a collaborator.
CollaboratorResponse
Response with collaborator information.
CreateWebhookRequest
Request to create a webhook.
OrgMember
A member of an organization.
Organization
An organization for multi-user repository ownership.
PermissionGrant
A permission grant for a specific resource.
Team
A team within an organization.
UpdateWebhookRequest
Request to update a webhook.
Webhook
A webhook subscription for a repository.
WebhookPayload
Webhook delivery payload.
WebhookRepository
Repository information for webhook payloads.

Enums§

AuthError
Errors that can occur in authorization operations.
OrgRole
Role within an organization.
Permission
Permission level for repository access.
WebhookEvent
Events that can trigger webhooks.

Type Aliases§

Result
Result type for auth operations.