You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-panel/lib/NGCP/Panel/AuthenticationStore/RoleFromRealm.pm

25 lines
794 B

package NGCP::Panel::AuthenticationStore::RoleFromRealm;
use Sipwise::Base;
extends 'Catalyst::Authentication::Store::DBIx::Class::User';
sub roles {
my ($self) = @_;
if ($self->auth_realm) {
for my $auth_type (qw/admin api_admin_cert api_admin_http/) {
if ($auth_type eq $self->auth_realm) {
$self->_user->is_superuser ? return "admin"
: return "reseller";
}
}
foreach my $auth_type (qw/subscriber api_subscriber/) {
if ($auth_type eq $self->auth_realm) {
$self->_user->admin ? return "subscriberadmin"
: return "subscriber";
}
}
}
return "invalid";
}
# vim: set tabstop=4 expandtab: