-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from TelemetryDeck/OrganisationSwitcher
OrgSwitcher
- Loading branch information
Showing
8 changed files
with
188 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// OrganizationInfo.swift | ||
// Telemetry Viewer | ||
// | ||
// Created by Lukas on 29.05.24. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct OrganizationInfo: Codable, Equatable { | ||
var id: UUID | ||
var name: String | ||
var stripeCustomerID: String? | ||
var stripeMaxSignals: Double? | ||
var maxSignalsMultiplier: Double? | ||
var resolvedMaxSignals: Int64 | ||
var isInRestrictedMode: Bool | ||
var countryCode: String? | ||
var referralCode: String | ||
var usagePercentage: Double? | ||
var isSuperOrg: Bool | ||
var apps: [AppInfo] | ||
var basePermissions: AppAccessLevel | ||
var roleOrganizationPermissions: AppAccessLevel? | ||
|
||
var appIDs: [UUID] { | ||
apps.map { app in | ||
app.id | ||
} | ||
} | ||
|
||
} | ||
|
||
public enum AppAccessLevel: String, Codable, Comparable { | ||
case none | ||
case read | ||
case write | ||
case administrate | ||
|
||
public static func < (lhs: AppAccessLevel, rhs: AppAccessLevel) -> Bool { | ||
switch lhs { | ||
case .none: | ||
switch rhs { | ||
case .none: | ||
false | ||
case .read: | ||
true | ||
case .write: | ||
true | ||
case .administrate: | ||
true | ||
} | ||
case .read: | ||
switch rhs { | ||
case .none: | ||
false | ||
case .read: | ||
false | ||
case .write: | ||
true | ||
case .administrate: | ||
true | ||
} | ||
case .write: | ||
switch rhs { | ||
case .none: | ||
false | ||
case .read: | ||
false | ||
case .write: | ||
false | ||
case .administrate: | ||
true | ||
} | ||
case .administrate: | ||
false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.