Refactoring nasty conditional.

This commit is contained in:
sergiotarxz 2021-02-10 01:05:27 +01:00
parent cc509ec22a
commit 338579adc5
Signed by: sergiotarxz
GPG Key ID: E5903508B6510AC2
1 changed files with 2 additions and 5 deletions

View File

@ -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)
}