From 7a875798fea9321bad2636040d9be2c30bc0fa8f Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 22:16:14 -0500 Subject: feat: add repository acl management Implements: https://todo.sr.ht/~ccleberg/hutch/39 Implements: https://todo.sr.ht/~ccleberg/hutch/40 Implements: https://todo.sr.ht/~ccleberg/hutch/41 --- Hutch/Models/Git.swift | 2 +- Hutch/Models/RepositoryACL.swift | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Hutch/Models/RepositoryACL.swift (limited to 'Hutch/Models') diff --git a/Hutch/Models/Git.swift b/Hutch/Models/Git.swift index a45086b..3629ce4 100644 --- a/Hutch/Models/Git.swift +++ b/Hutch/Models/Git.swift @@ -10,7 +10,7 @@ enum Visibility: String, Codable, Sendable { } /// Repository access mode. -enum AccessMode: String, Codable, Sendable { +enum AccessMode: String, Codable, Sendable, CaseIterable { case ro = "RO" case rw = "RW" } diff --git a/Hutch/Models/RepositoryACL.swift b/Hutch/Models/RepositoryACL.swift new file mode 100644 index 0000000..e5f5eb1 --- /dev/null +++ b/Hutch/Models/RepositoryACL.swift @@ -0,0 +1,20 @@ +import Foundation + +struct RepositoryACLEntry: Codable, Sendable, Identifiable, Hashable { + let id: Int + let mode: AccessMode + let entity: Entity +} + +extension AccessMode { + var shortLabel: String { rawValue } + + var displayName: String { + switch self { + case .ro: + "Read Only" + case .rw: + "Read/Write" + } + } +} -- cgit v1.2.3