Bug 8262 - Special kohaadmin cannot create lists
Summary: Special kohaadmin cannot create lists
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact:
URL:
Keywords:
Depends on: 9032
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-18 07:30 UTC by Amit Bondwal
Modified: 2014-12-07 20:07 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 8262: Special kohaadmin cannot create lists (4.53 KB, patch)
2014-03-03 09:12 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 8262: Follow-up for bootstrap theme (1.62 KB, patch)
2014-03-03 09:12 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 8262: Special kohaadmin cannot create lists (6.03 KB, patch)
2014-03-10 07:54 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Attachment to Bug 8262 - Special kohaadmin cannot create lists (6.04 KB, patch)
2014-03-11 10:27 UTC, Jesse Maseto
Details | Diff | Splinter Review
[PASSED QA] Bug 8262: Special kohaadmin cannot create lists (6.21 KB, patch)
2014-03-23 20:36 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Bondwal 2012-06-18 07:30:22 UTC
Hi Folks,

I am new to koha, I installed koha 3.8.1 on centos 6.2 working fine, but
when I tried to use List option on administration, It did not create List.

When I tried to create a new List, It open popup window and ask for List Name 
and Select public and private etc., When I saved the List it shows nothing in Lists. 

Please help me.

Thanks and regards
Amit Bondwal
Comment 1 Marcel de Rooy 2012-06-18 08:20:10 UTC
Hi Amit,
Could you please describe the exact steps to reproduce your problem. The more details you provide, the better help you may get. 
Are you using opac or staff client? Are you logged in?
Comment 2 verolencinas 2012-09-20 13:12:32 UTC
The problem is solved if you create the list logged in as a normal user (not kohaadmin).
If you try to create a list logged in as administrator, you don't have a borrowernumber and koha can't create lists who don't belong to a user.
Comment 3 Marcel de Rooy 2012-09-24 07:59:02 UTC
I would like to reopen this report.
verolencinas: What you say, is correct. But i would say that it is not a solution but a workaround.
Koha should give a warning on screen here and not only produce a sql error in the logfile.
I will submit a proposed patch soon to check the user and raise a warning in this situation.
Comment 4 Marc Véron 2012-09-27 16:33:07 UTC
Marcel,

Your patch would address Paul P.'s comment to following bug:

Bug 8641 - Add information warning about log-in as root user to About->System information
(Pushed to Master)

See: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8641#c4

Marc
Comment 5 Marcel de Rooy 2014-03-03 09:12:24 UTC Comment hidden (obsolete)
Comment 6 Marcel de Rooy 2014-03-03 09:12:29 UTC Comment hidden (obsolete)
Comment 7 Marcel de Rooy 2014-03-03 09:13:27 UTC
I have built this upon patches for bug 9032.
Please wait testing this until I submitted these patches.
Thanks.
Comment 8 Owen Leonard 2014-03-06 15:10:24 UTC
Existing warnings in the staff client use the term "database administrator account." I think this patch should use the same phrase, instead of "special administrator account."
Comment 9 Kyle M Hall 2014-03-07 17:31:12 UTC
Instead of having all this code in the perl scripts, wouldn't it be far simpler to to check C4::Context->userenv->{number} and display a warning that this account can't create a list? 

A TT plugin for userenv access could simplify this even more. I think a UserEnv sub that returned whatever $userenv->{$key} could easily be added to the Koha TT plugin.

In addition, the code assumes that any failure should generate this message, which may not always be the case. I'd say that's a qa blocker.
Comment 10 Marcel de Rooy 2014-03-07 20:07:25 UTC
(In reply to Kyle M Hall from comment #9)
> Instead of having all this code in the perl scripts, wouldn't it be far
> simpler to to check C4::Context->userenv->{number} and display a warning
> that this account can't create a list? 
> 
> A TT plugin for userenv access could simplify this even more. I think a
> UserEnv sub that returned whatever $userenv->{$key} could easily be added to
> the Koha TT plugin.
> 
> In addition, the code assumes that any failure should generate this message,
> which may not always be the case. I'd say that's a qa blocker.

All this code is only a few lines (the AddShelf line is an improvement in any case). But I would not oppose a warning in the template either.

A better message would be fine. The actual warning is now: List could not be created (which is pretty generic :) Between brackets, a reminder Do not use kohaadmin (which will be in this case btw a frequent cause).

No blockers for me. How do we get this further now?
Comment 11 Marcel de Rooy 2014-03-10 07:54:56 UTC Comment hidden (obsolete)
Comment 12 Marcel de Rooy 2014-03-10 07:57:58 UTC
New patch includes the bootstrap change too now.
Thanks Owen and Kyle for suggestions.
Made the template varname generic and the error message dependent of loggedinuser.
Comment 13 Jesse Maseto 2014-03-11 10:27:01 UTC Comment hidden (obsolete)
Comment 14 Katrin Fischer 2014-03-23 20:36:36 UTC
Created attachment 26526 [details] [review]
[PASSED QA] Bug 8262: Special kohaadmin cannot create lists

Since kohaadmin has no borrower number, it cannot create lists.
A database error is logged, but the user is not notified.
This patch alerts the user (kohaadmin).
In the incidental case that a normal user gets a database error,
he is notified too that the list could not be created.

Test plan (for prog and bootstrap):
This patch should be applied on top of 9032 patches.
Login as kohaadmin.
Create a list in opac and staff. Check the message.
Login as a normal user.
Force a database error on list creation (I renamed category
in the table with alter table change column..)
You should have a different error message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.
Comment 15 Galen Charlton 2014-04-20 23:00:34 UTC
Pushed to master.  Thanks, Marcel!