diff options
| author | Christian Cleberg <[email protected]> | 2026-04-12 22:16:14 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-12 22:16:14 -0500 |
| commit | 7a875798fea9321bad2636040d9be2c30bc0fa8f (patch) | |
| tree | b0569f6413454f423c4ddaa6b25307bc987ef81d /Hutch/Models | |
| parent | 86bcd9452d3107f68aca085e03e69b02667c0dbb (diff) | |
| download | hutch-7a875798fea9321bad2636040d9be2c30bc0fa8f.tar.gz hutch-7a875798fea9321bad2636040d9be2c30bc0fa8f.tar.bz2 hutch-7a875798fea9321bad2636040d9be2c30bc0fa8f.zip | |
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
Diffstat (limited to 'Hutch/Models')
| -rw-r--r-- | Hutch/Models/Git.swift | 2 | ||||
| -rw-r--r-- | Hutch/Models/RepositoryACL.swift | 20 |
2 files changed, 21 insertions, 1 deletions
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" + } + } +} |
