Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digibib
deichman
Commits
58fbd99f
Commit
58fbd99f
authored
Jan 08, 2019
by
Benjamin Rokseth
Browse files
koha: add C4::Auth::haspermission override
parent
e2894d67
Changes
1
Hide whitespace changes
Inline
Side-by-side
koha/Deichman/Plack/Middleware/Session.pm
View file @
58fbd99f
...
...
@@ -121,6 +121,21 @@ sub call {
return
"
failed
";
};
local
*
{
C4::Auth::
checkauth
}
=
sub
{
$session
};
local
*
{
C4::Auth::
haspermission
}
=
sub
{
my
(
$userid
,
$perm
)
=
@_
;
if
(
my
$auth
=
$session
->
param
("
auth
"))
{
# TODO: This logic is only satisfy REST Api v1 which checks permissions on its own
if
(
$perm
)
{
my
(
$want
)
=
%
{
$perm
};
my
$hit
=
$auth
->
{
permissions
}
->
{
$want
};
$hit
and
return
$auth
->
{
permissions
};
}
else
{
# C4::Auth::haspermission called without arguments expects all permissions (!?)
return
$auth
->
{
permissions
};
}
}
return
0
;
};
local
*
{
C4::Context::
userenv
}
=
sub
{
$session
->
{
data
}
};
# TODO override all context methods?
#local *{C4::Context::set_userenv} = sub { };
...
...
Benjamin
@bensinober
mentioned in commit
ee2d5f5f
·
Jan 08, 2019
mentioned in commit
ee2d5f5f
mentioned in commit ee2d5f5fcb555cd79cb29f6f3154991abb0261a7
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment