Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes privileges enum. #55

Merged
merged 5 commits into from
Feb 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions privileges/privileges.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
// Package privileges contains the different privileges that can be given to a user.
// Privilege names and values defined here come from values stored on chain.
package privileges

// Privilege is a type for the different privileges that can be given.
type Privilege int64

const (
// NonLocationData provides access to all data excluding location data.
NonLocationData Privilege = 1
// VehicleNonLocationData provides access to all data excluding location data.
VehicleNonLocationData int64 = 1

// Commands provides access to all commands that can be sent to the device.
Commands Privilege = 2
// VehicleCommands provides access to all commands that can be sent to the device.
VehicleCommands int64 = 2

// CurrentLocation provides access to the current location of the device.
CurrentLocation Privilege = 3
// VehicleCurrentLocation provides access to the current location of the device.
VehicleCurrentLocation int64 = 3

// AllTimeLocation provives access to current and historical location data.
AllTimeLocation Privilege = 4
// VehicleAllTimeLocation provives access to current and historical location data.
VehicleAllTimeLocation int64 = 4
)

// String returns the string representation of a privilege.
func (p Privilege) String() string {
// PrivilegeString returns the string representation of a privilege.
func PrivilegeString(p int64) string {
switch p {
case NonLocationData:
case VehicleNonLocationData:
return "NonLocationData"
case Commands:
case VehicleCommands:
return "Commands"
case CurrentLocation:
case VehicleCurrentLocation:
return "CurrentLocation"
case AllTimeLocation:
case VehicleAllTimeLocation:
return "AllTimeLocation"
default:
return "Unknown"
Expand Down
Loading