Skip to content
Snippets Groups Projects
Commit 73a741d1 authored by Silas Davis's avatar Silas Davis Committed by GitHub
Browse files

Merge pull request #569 from VoR0220/fixFromIntToBool

change from uints to bools because it makes more sense
parents 788ae87d 57a9bfe2
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ package types ...@@ -19,7 +19,7 @@ package types
// than zero to set the permission. For all unmentioned permissions the ZeroBasePermissions // than zero to set the permission. For all unmentioned permissions the ZeroBasePermissions
// is defaulted to. // is defaulted to.
// TODO: [ben] re-evaluate the use of int for setting the permission. // TODO: [ben] re-evaluate the use of int for setting the permission.
func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]int, roles []string) (*AccountPermissions, error) { func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bool, roles []string) (*AccountPermissions, error) {
var err error var err error
accountPermissions := &AccountPermissions{} accountPermissions := &AccountPermissions{}
accountPermissions.Base, err = convertPermissionsMapStringIntToBasePermissions(permissions) accountPermissions.Base, err = convertPermissionsMapStringIntToBasePermissions(permissions)
...@@ -32,7 +32,7 @@ func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]in ...@@ -32,7 +32,7 @@ func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]in
// convertPermissionsMapStringIntToBasePermissions converts a map of string-integer pairs to // convertPermissionsMapStringIntToBasePermissions converts a map of string-integer pairs to
// BasePermissions. // BasePermissions.
func convertPermissionsMapStringIntToBasePermissions(permissions map[string]int) (BasePermissions, error) { func convertPermissionsMapStringIntToBasePermissions(permissions map[string]bool) (BasePermissions, error) {
// initialise basePermissions as ZeroBasePermissions // initialise basePermissions as ZeroBasePermissions
basePermissions := ZeroBasePermissions basePermissions := ZeroBasePermissions
...@@ -42,7 +42,7 @@ func convertPermissionsMapStringIntToBasePermissions(permissions map[string]int) ...@@ -42,7 +42,7 @@ func convertPermissionsMapStringIntToBasePermissions(permissions map[string]int)
return basePermissions, err return basePermissions, err
} }
// sets the permissions bitflag and the setbit flag for the permission. // sets the permissions bitflag and the setbit flag for the permission.
basePermissions.Set(permissionsFlag, value > 0) basePermissions.Set(permissionsFlag, value)
} }
return basePermissions, nil return basePermissions, nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment