opers: Enforce oper class permissions

This commit is contained in:
Daniel Oaks
2016-10-23 11:13:08 +10:00
parent f3459830e7
commit 8e2a8cb1b3
2 changed files with 22 additions and 0 deletions
+15
View File
@@ -247,6 +247,21 @@ func (client *Client) HasUsername() bool {
return client.username != "" && client.username != "*"
}
// HasCapabs returns true if client has the given (role) capabilities.
func (client *Client) HasCapabs(capabs ...string) bool {
if client.class == nil {
return false
}
for _, capab := range capabs {
if !client.class.Capabilities[capab] {
return false
}
}
return true
}
// <mode>
func (c *Client) ModeString() (str string) {
str = "+"