Refactoring nasty conditional.
This commit is contained in:
parent
cc509ec22a
commit
338579adc5
|
@ -21,11 +21,8 @@ func New(id int64, groupname string, permissions map[string]string) Group {
|
|||
func (self Group) HasPermission(permission string) string {
|
||||
perm_value, ok := self.Permissions[permission]
|
||||
if ok {
|
||||
if perm_value == "yes" {
|
||||
return "yes"
|
||||
}
|
||||
if perm_value == "no" {
|
||||
return "no"
|
||||
if perm_value == "yes" || perm_value == "no" {
|
||||
return perm_value
|
||||
}
|
||||
log.Printf("Invalid permission value for %s in group %s.\n", permission, self.Groupname)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue