guts_auth/lib.rs
1//! Authorization and governance for Guts.
2//!
3//! This crate provides:
4//! - **Permissions**: Granular access control (Read, Write, Admin)
5//! - **Organizations**: Multi-user repository ownership
6//! - **Teams**: Group-based permission management
7//! - **Collaborators**: Direct repository access grants
8//! - **Branch Protection**: Rules for protecting important branches
9//! - **Webhooks**: Event notifications for CI/CD integration
10//!
11//! # Example
12//!
13//! ```
14//! use guts_auth::{AuthStore, Permission, OrgMember, OrgRole};
15//!
16//! // Create a store
17//! let store = AuthStore::new();
18//!
19//! // Create an organization
20//! let org = store.create_organization(
21//! "acme".into(),
22//! "Acme Corporation".into(),
23//! "owner_pubkey".into(),
24//! ).unwrap();
25//!
26//! // Create a team with write access
27//! let team = store.create_team(
28//! org.id,
29//! "backend".into(),
30//! Permission::Write,
31//! "owner_pubkey".into(),
32//! ).unwrap();
33//!
34//! // Add a member to the team
35//! store.add_team_member(team.id, "developer_pubkey".into()).unwrap();
36//!
37//! // Add a repository to the team
38//! store.add_team_repo(team.id, "acme/api".into()).unwrap();
39//!
40//! // Check permissions
41//! assert!(store.check_permission("developer_pubkey", "acme/api", Permission::Write));
42//! ```
43
44mod branch_protection;
45mod collaborator;
46mod error;
47mod organization;
48mod permission;
49mod store;
50mod team;
51mod webhook;
52
53pub use branch_protection::{BranchProtection, BranchProtectionRequest};
54pub use collaborator::{Collaborator, CollaboratorRequest, CollaboratorResponse};
55pub use error::{AuthError, Result};
56pub use organization::{OrgMember, OrgRole, Organization};
57pub use permission::{Permission, PermissionGrant};
58pub use store::AuthStore;
59pub use team::Team;
60pub use webhook::{
61 CreateWebhookRequest, UpdateWebhookRequest, Webhook, WebhookEvent, WebhookPayload,
62 WebhookRepository,
63};