QBit::Application - base class for create applications.
It union all project models.
timelog
Short method description
Arguments:
%opts - additional arguments:
Return value: type, description
$filename - type, description
return option by name
$name - string
$default - default value
Return value: value
#> pwd # # /home/app # #> cat ./lib/Application.cfg # # salt => 'terc3s', # path => '${ApplicationPath}data', # lib => ['./t_lib', '${ApplicationPath}lib'], # opt => { # key => 'value', # } my $salt = $self->get_option('salt', 's3cret'); # 'terc3s' my $salt2 = $self->get_option('salt2', 's3cret'); # 's3cret' my $path = $self->get_option('path'); # '/home/app/data' my $lib = $self->get_option('lib'); # ['./t_lib', '/home/app/lib'] my $opts = $self->get_option('opt', {key => 'value2'}); # {key => 'value'}
set option
$value - value
$app->set_option('salt', 's3cret'); $app->set_option('locales', [qw(ru en)]);
set or get current user
$user - hash ref
Return value: hash ref
my $user = {id => 1}; $cur_user = $app->cur_user($user); # set current user # if use rbac # {id => 1, roles => {3 => {id => 3, name => 'ROLE 3', description => 'ROLE 3'}}, rights => ['RIGHT1', 'RIGHT2']} # or # {id => 1} $cur_user = $app->cur_user(); # return current user or {} $app->cur_user({}); # remove current user
set rights for current user
$rights - array ref
$app->set_cur_user_rights([qw(RIGHT1 RIGHT2)]);
revoke rights for current user
$app->revoke_cur_user_rights([qw(RIGHT1 RIGHT2)]);
refresh rights for current user
my $cur_user_id = $app->cur_user()->{'id'}; $app->rbac->set_user_role($cur_user_id, 3); # role_id = 3 $app->refresh_rights();
No arguments.
check rights for current user
@rights - array of strings or array ref
Return value: boolean
$app->check_rights('RIGHT1', 'RIGHT2'); # TRUE if has rights 'RIGHT1' and 'RIGHT2' $app->check_rights(['RIGHT1', 'RIGHT2']); # TRUE if has rights 'RIGHT1' or 'RIGHT2'
$locale_id - type, description
@rights - type, description
$cycles - type, description
$config - type, description
To install QBit::Application, copy and paste the appropriate command in to your terminal.
cpanm
cpanm QBit::Application
CPAN shell
perl -MCPAN -e shell install QBit::Application
For more information on module installation, please visit the detailed CPAN module installation guide.