diff --git a/permission/types/util.go b/permission/types/util.go index 9f9000d11fec0cc7765530fec929c76334e26da3..c7ceae90bd1f97e30793551cb04f73104df629eb 100644 --- a/permission/types/util.go +++ b/permission/types/util.go @@ -14,11 +14,11 @@ package types -// ConvertMapStringIntToPermissions converts a map of string-integer pairs and a slice of -// strings for the roles to an AccountPermissions type. The integer needs to be greater -// than zero to set the permission. For all unmentioned permissions the ZeroBasePermissions -// is defaulted to. -// TODO: [ben] re-evaluate the use of int for setting the permission. +// ConvertMapStringIntToPermissions converts a map of string-bool pairs and a slice of +// strings for the roles to an AccountPermissions type. If the value in the +// permissions map is true for a particular permission string then the permission +// will be set in the AccountsPermissions. For all unmentioned permissions the +// ZeroBasePermissions is defaulted to. func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bool, roles []string) (*AccountPermissions, error) { var err error accountPermissions := &AccountPermissions{} @@ -30,8 +30,8 @@ func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bo return accountPermissions, nil } -// convertPermissionsMapStringIntToBasePermissions converts a map of string-integer pairs to -// BasePermissions. +// convertPermissionsMapStringIntToBasePermissions converts a map of string-bool +// pairs to BasePermissions. func convertPermissionsMapStringIntToBasePermissions(permissions map[string]bool) (BasePermissions, error) { // initialise basePermissions as ZeroBasePermissions basePermissions := ZeroBasePermissions