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

Add more capabilities to default groups

This commit is contained in:
Pragmatic Software 2020-02-05 17:55:31 -08:00
parent 0656c7841d
commit 97a913ef32
8 changed files with 19 additions and 5 deletions

View File

@ -79,6 +79,7 @@ sub initialize {
$self->{pbot}->{commands}->register(sub { return $self->unbanme(@_) }, "unbanme", 0);
$self->{pbot}->{commands}->register(sub { return $self->whitelist(@_) }, "whitelist", 1);
$self->{pbot}->{capabilities}->add('admin', 'can-whitelist', 1);
$self->{pbot}->{event_dispatcher}->register_handler('irc.whoisaccount', sub { $self->on_whoisaccount(@_) });
$self->{pbot}->{event_dispatcher}->register_handler('irc.whoisuser', sub { $self->on_whoisuser(@_) });

View File

@ -42,6 +42,7 @@ sub initialize {
$self->{pbot}->{registry}->add_default('text', 'antispam', 'enforce', $conf{enforce_antispam} // 1);
$self->{pbot}->{commands}->register(sub { return $self->antispam_cmd(@_) }, "antispam", 1);
$self->{pbot}->{capabilities}->add('admin', 'can-antispam', 1);
}
sub is_spam {

View File

@ -34,6 +34,7 @@ sub initialize {
$self->{filename} = $conf{filename};
$self->{blacklist} = {};
$self->{pbot}->{commands}->register(sub { $self->blacklist(@_) }, "blacklist", 1);
$self->{pbot}->{capabilities}->add('admin', 'can-blacklist', 1);
$self->load_blacklist;
}

View File

@ -41,14 +41,14 @@ sub initialize {
$self->add('can-group-capabilities', undef, 1);
$self->add('can-ungroup-capabilities', undef, 1);
# add admin capabilities group
$self->add('admin', 'chanop', 1); # add chanop capabilities group -- see ChanOpCommands.md
# add capabilites to admin capabilities group
$self->add('admin', 'chanop', 1); # add chanop capabilities group to admin group -- see ChanOpCommands.md
$self->add('admin', 'can-useradd', 1);
$self->add('admin', 'can-userdel', 1);
$self->add('admin', 'can-userset', 1);
$self->add('admin', 'can-userunset', 1);
$self->add('admin', 'can-join', 1);
$self->add('admin', 'can-part', 1);
$self->add('admin', 'can-mode', 1);
$self->add('admin', 'can-mode-any', 1);
}
sub has {
@ -254,7 +254,7 @@ sub capcmd {
my $u = $self->{pbot}->{users}->loggedin($from, "$nick!$user\@$host");
return "You must be logged into your user account to remove capabilities from groups." if not defined $u;
return "You must have the can-remove-capabilities capability to remove capabilities from groups." if not $self->userhas($u, 'can-ungroup-capabilities');
return "You must have the can-ungroup-capabilities capability to remove capabilities from groups." if not $self->userhas($u, 'can-ungroup-capabilities');
return "Capability $subcap does not belong to the $cap capability group." if not $self->has($cap, $subcap);
$self->remove($cap, $subcap);

View File

@ -39,6 +39,10 @@ sub initialize {
$self->{pbot}->{commands}->register(sub { $self->add(@_) }, "chanadd", 1);
$self->{pbot}->{commands}->register(sub { $self->remove(@_) }, "chanrem", 1);
$self->{pbot}->{commands}->register(sub { $self->list(@_) }, "chanlist", 1);
$self->{pbot}->{capabilities}->add('admin', 'can-join', 1);
$self->{pbot}->{capabilities}->add('admin', 'can-part', 1);
$self->{pbot}->{capabilities}->add('admin', 'can-chanlist', 1);
}
sub join {

View File

@ -43,6 +43,8 @@ sub initialize {
$self->register(sub { $self->help(@_) }, "help", 0);
$self->register(sub { $self->uptime(@_) }, "uptime", 0);
$self->register(sub { $self->in_channel(@_) }, "in", 1);
$self->{pbot}->{capabilities}->add('admin', 'in', 1);
}
sub register {

View File

@ -31,6 +31,8 @@ sub initialize {
$self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
$self->{pbot}->{commands}->register(sub { $self->ignore_user(@_) }, "ignore", 1);
$self->{pbot}->{commands}->register(sub { $self->unignore_user(@_) }, "unignore", 1);
$self->{pbot}->{capabilities}->add('admin', 'can-ignore', 1);
$self->{pbot}->{capabilities}->add('admin', 'can-unignore', 1);
}
sub ignore_user {

View File

@ -56,6 +56,9 @@ sub initialize {
$self->{pbot}->{commands}->register(sub { $self->aka_link(@_) }, "akalink", 1);
$self->{pbot}->{commands}->register(sub { $self->aka_unlink(@_) }, "akaunlink", 1);
$self->{pbot}->{capabilities}->add('admin', 'can-akalink', 1);
$self->{pbot}->{capabilities}->add('admin', 'can-akaunlink', 1);
$self->{pbot}->{atexit}->register(sub { $self->{database}->end(); return; });
}