3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

Users: allow botowner to userset/userunset capabilities they do not have

This commit is contained in:
Pragmatic Software 2020-02-03 18:13:03 -08:00
parent 6267cc04d2
commit 9b86da6047

View File

@ -410,7 +410,7 @@ sub userset {
} }
if ($self->{pbot}->{capabilities}->exists($key) and not $self->{pbot}->{capabilities}->userhas($u, $key)) { if ($self->{pbot}->{capabilities}->exists($key) and not $self->{pbot}->{capabilities}->userhas($u, $key)) {
return "To set the $key capability your user account must also have it."; return "To set the $key capability your user account must also have it." unless $self->{pbot}->{capabilities}->userhas($u, 'botowner');
} }
my ($found_channel, $found_hostmask) = $self->find_user_account($channel, $hostmask); my ($found_channel, $found_hostmask) = $self->find_user_account($channel, $hostmask);
@ -456,7 +456,7 @@ sub userunset {
} }
if (defined $key and $self->{pbot}->{capabilities}->exists($key) and not $self->{pbot}->{capabilities}->userhas($u, $key)) { if (defined $key and $self->{pbot}->{capabilities}->exists($key) and not $self->{pbot}->{capabilities}->userhas($u, $key)) {
return "To unset the $key capability your user account must also have it."; return "To unset the $key capability your user account must also have it." unless $self->{pbot}->{capabilities}->userhas($u, 'botowner');
} }
my ($found_channel, $found_hostmask) = $self->find_user_account($channel, $hostmask); my ($found_channel, $found_hostmask) = $self->find_user_account($channel, $hostmask);