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
539cf389
Commit
539cf389
authored
Jan 09, 2019
by
Benjamin Rokseth
Browse files
koha: LDAP make sure to map patron attributes from koha
parent
808ee03d
Changes
1
Hide whitespace changes
Inline
Side-by-side
koha/Deichman/Auth/LDAP.pm
View file @
539cf389
...
...
@@ -41,10 +41,10 @@ sub DoAuth {
# auth magic here
$ldap
->
unbind
;
if
(
$ldapAuth
->
{
resultCode
}
==
0
)
{
warn
"
Autenticated!
";
$self
->
{
auth
}
->
{
user
}
=
$self
->
process
KohaPatron
();
warn
"
Aut
h
enticated!
";
$self
->
{
auth
}
->
{
user
}
=
$self
->
userTo
KohaPatron
Attributes
();
$self
->
{
auth
}
->
{
permissions
}
=
$self
->
processKohaPermissions
();
$self
->
syncToKoha
();
my
$kohaPatron
=
$self
->
syncToKoha
();
$self
->
updateSessionAuthFromKohaPatron
(
$kohaPatron
);
# fetch from Koha
return
$self
;
}
else
{
...
...
@@ -58,8 +58,8 @@ sub getAuthenticationObject {
return
$self
->
{
auth
};
};
# util to map LDAP employee to patron object
, need fixing
sub
process
KohaPatron
{
# util to map LDAP employee to patron object
sub
userTo
KohaPatron
Attributes
{
my
(
$self
)
=
@_
;
return
{
categorycode
=>
"
ANS
",
...
...
@@ -96,18 +96,19 @@ sub syncToKoha {
my
(
$self
)
=
@_
;
warn
"
SYNCING USER TO KOHA
";
my
$patron
=
$self
->
{
auth
}
->
{
user
};
my
$kohaPatron
;
try
{
my
$kohaPatron
=
Deichman::
Patron
->
new
()
->
GetByUserId
(
$patron
->
{
email
});
$kohaPatron
=
Deichman::
Patron
->
new
()
->
GetByUserId
(
$patron
->
{
email
});
warn
"
UPDATING PATRON FROM LDAP
";
$kohaPatron
->
Update
(
$patron
);
return
$
self
;
return
$
kohaPatron
;
}
catch
{
warn
$_
;
warn
"
LDAP USER NOT FOUND: ADDING NEW PATRON
";
$self
->
addDefaultPatronAttributes
();
$self
->
addNewKohaPatron
();
$kohaPatron
=
$self
->
addNewKohaPatron
();
};
return
$
self
;
return
$
kohaPatron
;
};
sub
addDefaultPatronAttributes
{
...
...
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