How to introduce a new user-permission to Koha?
Dear Koha-Community, i did not find any hint oder documentation, where the permissions for using tools etc. are stored. My example: For testing purpose i want to insert my own perl-script into Koha and it should appear on the "tools"-page. The links on this page are shown to the user or not depending on the permissions he has: (tools-home.tt) [% IF ( CAN_user_tools_manage_staged_marc ) %] <dt><a href="/cgi-bin/koha/tools/bibliotheca_convert.pl">Bibliotheca-Datei hochladen</a></dt> <dd>Werkzeug um BIBLIOTHECAplus-Exportdatei für den Import hochzuladen</dd> [% END %] I can not find the place, where these rights are deposited. How does Koha know if a certain right is existing? I found the file permissions.inc but changes there did not having any effect. Of cource i could use the permission "CAN_user_tools_manage_staged_marc" for my own script (and then the link is shown), but IMHO it would be not correct to "steal" the permission of another script. I would be very grateful if someone could give me a hint how to introduce the permission to start my script to Koha. Thank You very much in Advance, Markus Becker
Kia ora Markus Shifting this over to the development list. As you are more likely to get an answer there. If no one has answered by the time I get in front of a computer, I'll try :) Chris On 14 June 2018 7:02:30 AM NZST, Markus Becker <beckmarkus@gmail.com> wrote:
Dear Koha-Community,
i did not find any hint oder documentation, where the permissions for using tools etc. are stored.
My example: For testing purpose i want to insert my own perl-script into Koha and it should appear on the "tools"-page.
The links on this page are shown to the user or not depending on the permissions he has: (tools-home.tt)
[% IF ( CAN_user_tools_manage_staged_marc ) %] <dt><a href="/cgi-bin/koha/tools/bibliotheca_convert.pl">Bibliotheca-Datei hochladen</a></dt> <dd>Werkzeug um BIBLIOTHECAplus-Exportdatei für den Import hochzuladen</dd> [% END %]
I can not find the place, where these rights are deposited. How does Koha know if a certain right is existing? I found the file permissions.inc but changes there did not having any effect.
Of cource i could use the permission "CAN_user_tools_manage_staged_marc" for my own script (and then the link is shown), but IMHO it would be not correct to "steal" the permission of another script.
I would be very grateful if someone could give me a hint how to introduce the permission to start my script to Koha.
Thank You very much in Advance, Markus Becker _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Hi Markus, Permissions are stored in the tables 'permissions' and 'userflags' For instance "tools" is a group of permissions (userflags.flag="tools" with a bit=13), and the permissions table will contain the subpermissions. select * from permissions where module_bit=13; will give your the subpermissions for tools. To use the script tools/modborrowers.pl (edit patrons in a batch) you will need the subpermission edit_patrons of the tools module. If you edit this file you will find the following line: flagsrequired => { tools => "edit_patrons" } The CAN_* flags in the template are set in C4::Auth "CAN_user_tools" means all the "tools" subpermissions CAN_user_tools_edit_patrons means the edit_patrons subpermission of the "tools" module. Take a look at commit f56d6530bc7ea00db0d2b158a8b2667d5ba16a41 Bug 16978: Add delete reports user permission it added the "reports => delete_reports" subpermission. Good luck :) Hope that makes sense! Jonathan On Wed, 13 Jun 2018 at 16:58 Chris Cormack <chrisc@catalyst.net.nz> wrote:
Kia ora Markus
Shifting this over to the development list. As you are more likely to get an answer there.
If no one has answered by the time I get in front of a computer, I'll try :)
Chris
On 14 June 2018 7:02:30 AM NZST, Markus Becker <beckmarkus@gmail.com> wrote:
Dear Koha-Community,
i did not find any hint oder documentation, where the permissions for using tools etc. are stored.
My example: For testing purpose i want to insert my own perl-script into Koha and it should appear on the "tools"-page.
The links on this page are shown to the user or not depending on the permissions he has: (tools-home.tt)
[% IF ( CAN_user_tools_manage_staged_marc ) %] <dt><a href="/cgi-bin/koha/tools/bibliotheca_convert.pl">Bibliotheca-Datei hochladen</a></dt> <dd>Werkzeug um BIBLIOTHECAplus-Exportdatei für den Import hochzuladen</dd> [% END %]
I can not find the place, where these rights are deposited. How does Koha know if a certain right is existing? I found the file permissions.inc but changes there did not having any effect.
Of cource i could use the permission "CAN_user_tools_manage_staged_marc" for my own script (and then the link is shown), but IMHO it would be not correct to "steal" the permission of another script.
I would be very grateful if someone could give me a hint how to introduce the permission to start my script to Koha.
Thank You very much in Advance, Markus Becker ------------------------------
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
-- Sent from my Android device with K-9 Mail. Please excuse my brevity. _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
Hi Jonathan, thank You very much - i will try this out! Yours, Markus 2018-06-13 22:30 GMT+02:00 Jonathan Druart <jonathan.druart@bugs.koha-community.org>:
Hi Markus,
Permissions are stored in the tables 'permissions' and 'userflags' For instance "tools" is a group of permissions (userflags.flag="tools" with a bit=13), and the permissions table will contain the subpermissions.
select * from permissions where module_bit=13; will give your the subpermissions for tools.
To use the script tools/modborrowers.pl (edit patrons in a batch) you will need the subpermission edit_patrons of the tools module. If you edit this file you will find the following line: flagsrequired => { tools => "edit_patrons" }
The CAN_* flags in the template are set in C4::Auth "CAN_user_tools" means all the "tools" subpermissions CAN_user_tools_edit_patrons means the edit_patrons subpermission of the "tools" module.
Take a look at commit f56d6530bc7ea00db0d2b158a8b2667d5ba16a41 Bug 16978: Add delete reports user permission it added the "reports => delete_reports" subpermission.
Good luck :) Hope that makes sense!
Jonathan
On Wed, 13 Jun 2018 at 16:58 Chris Cormack <chrisc@catalyst.net.nz> wrote:
Kia ora Markus
Shifting this over to the development list. As you are more likely to get an answer there.
If no one has answered by the time I get in front of a computer, I'll try :)
Chris
On 14 June 2018 7:02:30 AM NZST, Markus Becker <beckmarkus@gmail.com> wrote:
Dear Koha-Community,
i did not find any hint oder documentation, where the permissions for using tools etc. are stored.
My example: For testing purpose i want to insert my own perl-script into Koha and it should appear on the "tools"-page.
The links on this page are shown to the user or not depending on the permissions he has: (tools-home.tt)
[% IF ( CAN_user_tools_manage_staged_marc ) %] <dt><a href="/cgi-bin/koha/tools/bibliotheca_convert.pl">Bibliotheca-Datei hochladen</a></dt> <dd>Werkzeug um BIBLIOTHECAplus-Exportdatei für den Import hochzuladen</dd> [% END %]
I can not find the place, where these rights are deposited. How does Koha know if a certain right is existing? I found the file permissions.inc but changes there did not having any effect.
Of cource i could use the permission "CAN_user_tools_manage_staged_marc" for my own script (and then the link is shown), but IMHO it would be not correct to "steal" the permission of another script.
I would be very grateful if someone could give me a hint how to introduce the permission to start my script to Koha.
Thank You very much in Advance, Markus Becker ________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
-- Sent from my Android device with K-9 Mail. Please excuse my brevity. _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
participants (3)
-
Chris Cormack -
Jonathan Druart -
Markus Becker