Workflow/Activities/Authorities/Standard/PowerUserRole.pm untested

filter: Statementstmt 0.0% 0 / 55 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 62 CC 1 SCAR 6.9
CC
1
Cov
0%
create_power_role
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Daje::Workflow::Activities::Authorities::Standard::PowerUserRole;
2 use Mojo::Base 'Daje::Workflow::Activities::Authorities::Standard::Base', -base;
3 use v5.42;
4  
5 # NAME
6 # ====
7 #
8 # Daje::Workflow::Activities::Authorities::Standard::PowerUserRole - Daje Role creating activity,
9 # creates a new admin role and attach it to user and company
10 #
11 # SYNOPSIS
12 # ========
13 #
14 #
15 # DESCRIPTION
16 # ===========
17 #
18 # Daje::Workflow::Activities::Authorities::Standard::PowerUserRole creates a power user role
19 #
20 # METHODS
21 # =======
22 #
23 #
24 #
25 #
26 # SEE ALSO
27 # ========
28 #
29 # Mojolicious, Mojolicious::Guides, https://mojolicious.org.
30 #
31 # LICENSE
32 # =======
33 #
34 # Copyright (C) janeskil1525.
35 #
36 # This library is free software; you can redistribute it and/or modify
37 # it under the same terms as Perl itself.
38 #
39 # AUTHOR
40 # ======
41 #
42 # janeskil1525 E<lt>janeskil1525@gmail.com
43 #
44  
45 use Daje::Database::View::vAuthoritiesPluginList;
46 use Daje::Database::View::vAuthoritiesFunction;
47 use Daje::Database::View::vAuthoritiesPermissionsList;
48  
49 sub create_power_role($self) {
50 $self->model->insert_history(
51 "Power user role for new client",
52 "Daje::Workflow::Activities::Authorities::Standard::PowerUserRole::create_power_role",
53 1
54 );
55  
56 my $authorities_role_pkey = $self->createRole('Power User', 1);
57  
58 my $plugins = Daje::Database::View::vAuthoritiesPluginList->new(
59 db => $self->db
60 )->load_user_plugins()->{data};
61  
62 my $permissions = Daje::Database::View::vAuthoritiesPermissionsList->new(
63 db => $self->db
64 )->load_all_authorities_permissions()->{data};
65  
66 my $length = scalar @{$plugins};
67 for(my $i = 0; $i < $length; $i++) {
68 my $authorities_plugin_role_pkey = $self->create_role_plugin(
69 $authorities_role_pkey,
70 @{$plugins}[$i]->{authorities_plugin_pkey},
71 "Autogenerated"
72 );
73 my $functions = Daje::Database::View::vAuthoritiesFunction->new(
74 db => $self->db
75 )->load_authorities_plugin_fkey(
76 @{$plugins}[$i]->{authorities_plugin_pkey}
77 )->{data};
78  
79 my $len = scalar @{$functions};
80 for(my $j = 0; $j < $len; $j++) {
81 my $authorities_function_plugin_role_pkey = $self->create_function_plugin_role(
82 $authorities_role_pkey,
83 @{$functions}[$j]->{authorities_function_pkey},
84 @{$plugins}[$i]->{authorities_plugin_pkey},
85 "Autogenerated"
86 );
87 my $le = scalar @{$permissions};
88 for(my $k = 0; $k < $le; $k++) {
89 $self->create_role_permissions(
90 @{$permissions}[$k]->{authorities_permissions_pkey},
91 $authorities_role_pkey,
92 @{$functions}[$j]->{authorities_function_pkey},
93 @{$plugins}[$i]->{authorities_plugin_pkey}
94 );
95 }
96 }
97 }
98 }
99  
100 1;