mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-20 06:10:00 -08:00
Don't check for missing +traverse in ACL loop. Wait until all ACLs have been considered.
This commit is contained in:
parent
07bdd1c03b
commit
95509f9138
1 changed files with 9 additions and 9 deletions
4
acl.go
4
acl.go
|
|
@ -141,7 +141,7 @@ func NewChannelACL(channel *Channel) *ChannelACL {
|
||||||
|
|
||||||
// Check whether client has permission perm on channel. Perm *must* be a single permission,
|
// Check whether client has permission perm on channel. Perm *must* be a single permission,
|
||||||
// and not a combination of permissions.
|
// and not a combination of permissions.
|
||||||
func (server *Server) HasPermission(client *Client, channel *Channel, perm Permission) bool {
|
func (server *Server) HasPermission(client *Client, channel *Channel, perm Permission) (ok bool) {
|
||||||
// SuperUser can't speak or whisper, but everything else is OK
|
// SuperUser can't speak or whisper, but everything else is OK
|
||||||
if client.IsSuperUser() {
|
if client.IsSuperUser() {
|
||||||
if perm == SpeakPermission || perm == WhisperPermission {
|
if perm == SpeakPermission || perm == WhisperPermission {
|
||||||
|
|
@ -213,6 +213,7 @@ func (server *Server) HasPermission(client *Client, channel *Channel, perm Permi
|
||||||
granted &= ^acl.Deny
|
granted &= ^acl.Deny
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If traverse is not set and the user doesn't have write permissions
|
// If traverse is not set and the user doesn't have write permissions
|
||||||
// on the channel, the user will not have any permissions.
|
// on the channel, the user will not have any permissions.
|
||||||
// This is because -traverse removes all permissions, and +write grants
|
// This is because -traverse removes all permissions, and +write grants
|
||||||
|
|
@ -222,7 +223,6 @@ func (server *Server) HasPermission(client *Client, channel *Channel, perm Permi
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Cache the result
|
// Cache the result
|
||||||
server.aclcache.StorePermission(client, channel, granted)
|
server.aclcache.StorePermission(client, channel, granted)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue