Browse Source

Refactoring nasty conditional.

master
sergiotarxz 6 months ago
parent
commit
338579adc5
Signed by: sergiotarxz GPG Key ID: E5903508B6510AC2
  1. 7
      wwwshop/model/group/group.go

7
wwwshop/model/group/group.go

@ -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…
Cancel
Save