-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
// 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. | ||
// Privilege is an enum that represents the different privileges that can be given to a user. | ||
type Privilege int64 | ||
|
||
const ( | ||
// NonLocationData provides access to all data excluding location data. | ||
NonLocationData Privilege = 1 | ||
// ManufacureMintDevice provides access to minting a device. | ||
ManufacureMintDevice Privilege = 1 | ||
// ManufactureDistributeDevice provides access to distributing a device. | ||
ManufactureDistributeDevice Privilege = 2 | ||
// ManufactureFactoryReset provides access to factory resetting a device. | ||
ManufactureFactoryReset Privilege = 3 | ||
|
||
// Commands provides access to all commands that can be sent to the device. | ||
Commands Privilege = 2 | ||
// Vehicle Privileges. | ||
|
||
// CurrentLocation provides access to the current location of the device. | ||
CurrentLocation Privilege = 3 | ||
|
||
// AllTimeLocation provives access to current and historical location data. | ||
AllTimeLocation Privilege = 4 | ||
// VehicleNonLocationData provides access to all data excluding location data. | ||
VehicleNonLocationData Privilege = 1 | ||
// VehicleCommands provides access to all commands that can be sent to the device. | ||
VehicleCommands Privilege = 2 | ||
// VehicleCurrentLocation provides access to the current location of the device. | ||
VehicleCurrentLocation Privilege = 3 | ||
// VehicleAllTimeLocation provives access to current and historical location data. | ||
VehicleAllTimeLocation Privilege = 4 | ||
) | ||
|
||
// String returns the string representation of a privilege. | ||
func (p Privilege) String() string { | ||
switch p { | ||
case NonLocationData: | ||
// String returns the string representation of a VehiclePrivilege. | ||
func (v Privilege) String() string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add cases for the manufacturer ones? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I am going to get rid of it since we can't distinguish ManufacturerMintDevice and VehicleNonLocationData in any meaningful way. |
||
switch v { | ||
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" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manufacturer
? (misspelled in the first line)