Fix a little bug

This commit is contained in:
Henrique Dias 2017-07-14 08:26:41 +01:00
parent e78e106146
commit 5479236532
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
1 changed files with 6 additions and 0 deletions

View File

@ -292,6 +292,7 @@ func (m *FileManager) RegisterPermission(name string, value bool) error {
return nil return nil
} }
// Add the default value for this permission on the default user.
m.DefaultUser.Permissions[name] = value m.DefaultUser.Permissions[name] = value
for _, u := range m.Users { for _, u := range m.Users {
@ -299,6 +300,11 @@ func (m *FileManager) RegisterPermission(name string, value bool) error {
u.Permissions = map[string]bool{} u.Permissions = map[string]bool{}
} }
// Bypass the user if it is already defined.
if _, ok := u.Permissions[name]; ok {
continue
}
if u.Admin { if u.Admin {
u.Permissions[name] = true u.Permissions[name] = true
} else { } else {