Summary: | Create Koha::Session wrapper to create consistent sessions throughout Koha | ||
---|---|---|---|
Product: | Koha | Reporter: | David Cook <dcook> |
Component: | Architecture, internals, and plumbing | Assignee: | David Cook <dcook> |
Status: | RESOLVED DUPLICATE | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | ||
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: |
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28325 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17427 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24539 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32178 |
||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: |
Description
David Cook
2021-06-03 01:25:03 UTC
For instance: Koha::Session->set_user_session({ user => $patron, session => $session, extensions => { desk_id => $desk_id, shibboleth => $shibboleth, }, }); We'd take both the session object and data to put into it. The $session object would have 'ip' and 'lasttime' set automatically. Likewise: Koha::Session->set_userenv({ session => $session, extensions => { id => $userid, } }); The above would use session data or let you override particular key/value pairs using extensions. Although personally I find the concept of C4::Context->userenv to be unnecessary. You just need sessions, but Koha has a dependency on C4::Context->userenv... Actually, I think the key thing is having Koha::Session enforce a number of mandatory session variables. After reviewing C4::Auth::check_api_auth(), C4::Auth::checkauth(), C4::InstallAuth::checkauth(), the required keys for an authenticated user appear to be: - number - id - cardnumber - firstname - surname - branch - branchname - flags - emailaddress - ip - lasttime - interface (not set by C4::InstallAuth::checkauth() but is by the other 2) C4::Auth::checkauth() also sets "search_history", "desk_id", "desk_name", "shibboleth", "register_id", "register_name", "sco_user", and "cas_ticket". C4::Auth::check_api_auth() also sets "cas_ticket". |