|
Lines 33-38
use C4::Languages;
Link Here
|
| 33 |
use C4::Search::History; |
33 |
use C4::Search::History; |
| 34 |
use Koha; |
34 |
use Koha; |
| 35 |
use Koha::Caches; |
35 |
use Koha::Caches; |
|
|
36 |
use Koha::Cache::Memory::Lite; |
| 36 |
use Koha::AuthUtils qw(get_script_name hash_password); |
37 |
use Koha::AuthUtils qw(get_script_name hash_password); |
| 37 |
use Koha::Checkouts; |
38 |
use Koha::Checkouts; |
| 38 |
use Koha::DateUtils qw(dt_from_string); |
39 |
use Koha::DateUtils qw(dt_from_string); |
|
Lines 2086-2101
of the subpermission.
Link Here
|
| 2086 |
=cut |
2087 |
=cut |
| 2087 |
|
2088 |
|
| 2088 |
sub get_all_subpermissions { |
2089 |
sub get_all_subpermissions { |
|
|
2090 |
|
| 2091 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); |
| 2092 |
my $cache_key = "all_subpermissions"; |
| 2093 |
|
| 2094 |
my $cached = $memory_cache->get_from_cache($cache_key); |
| 2095 |
return $cached if $cached; |
| 2096 |
|
| 2089 |
my $dbh = C4::Context->dbh; |
2097 |
my $dbh = C4::Context->dbh; |
| 2090 |
my $sth = $dbh->prepare( "SELECT flag, code |
2098 |
my $permissions = $dbh->selectall_arrayref( q|SELECT flag, code |
| 2091 |
FROM permissions |
2099 |
FROM permissions |
| 2092 |
JOIN userflags ON (module_bit = bit)" ); |
2100 |
JOIN userflags ON (module_bit = bit)|, { Slice => {} } ); |
| 2093 |
$sth->execute(); |
|
|
| 2094 |
|
2101 |
|
| 2095 |
my $all_perms = {}; |
2102 |
my $all_perms = {}; |
| 2096 |
while ( my $perm = $sth->fetchrow_hashref ) { |
2103 |
for my $perm ( @$permissions ) { |
| 2097 |
$all_perms->{ $perm->{'flag'} }->{ $perm->{'code'} } = 1; |
2104 |
$all_perms->{ $perm->{'flag'} }->{ $perm->{'code'} } = 1; |
| 2098 |
} |
2105 |
} |
|
|
2106 |
|
| 2107 |
$memory_cache->set_in_cache( $cache_key, $all_perms ); |
| 2108 |
|
| 2099 |
return $all_perms; |
2109 |
return $all_perms; |
| 2100 |
} |
2110 |
} |
| 2101 |
|
2111 |
|
| 2102 |
- |
|
|