Fix a little bug

Former-commit-id: 2380ee0d969a1753ee6d4efd1ff74cefa1133055 [formerly 91904de9f465f417ff3a79efd7719ab6c58fcd92] [formerly 34cdd3196e0e540bd9b304089db03e5f2ba1be9b [formerly 5479236532]]
Former-commit-id: 1db58f77ad96ce839af3c51b08ce231aa4430a6b [formerly 4244d42e717ebe791d8ec1d58e113c17fae1772f]
Former-commit-id: 7e923c0ef560b29a2e3bc2bc6c21d075b49151c0
pull/726/head
Henrique Dias 2017-07-14 08:26:41 +01:00
parent 19ab3ecec3
commit 48964b28ff
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 {