Don't check for missing +traverse in ACL loop. Wait until all ACLs have been considered.

This commit is contained in:
Mikkel Krautz 2011-04-27 22:11:07 +02:00
parent 07bdd1c03b
commit 95509f9138

4
acl.go
View file

@ -141,7 +141,7 @@ func NewChannelACL(channel *Channel) *ChannelACL {
// Check whether client has permission perm on channel. Perm *must* be a single permission,
// 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
if client.IsSuperUser() {
if perm == SpeakPermission || perm == WhisperPermission {
@ -213,6 +213,7 @@ func (server *Server) HasPermission(client *Client, channel *Channel, perm Permi
granted &= ^acl.Deny
}
}
}
// If traverse is not set and the user doesn't have write permissions
// on the channel, the user will not have any permissions.
// 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
}
}
}
// Cache the result
server.aclcache.StorePermission(client, channel, granted)