1

Topic: error accessing table

Hi

I've been throwing various privileges at the taxon_images table in pgAdmin and it seems that no matter what I try the return error is always the same...

{"error":"Unknown Exception: No access to entity taxon_image allowed through view detail_taxon_images"}

Basically I'm accessing taxa_taxon_list, which works fine, to get at the taxa_meaning_id - but when I then try to load_existing_record using the taxon_images table where the taxon_image_id is 1234 it returns the above.

Any thoughts, help or general pointers in the right direction?

Ta very muchly

Iain

2

Re: error accessing table

Hi Iain,

Just a couple of starting thoughts.

The Postgres user and password that the warehouse uses to access the database are stored in application/config/database.php

If you log in to pgAdmin with this user are you able to view the data in the view, detail_taxon_images? (In the list of servers on the left, while not logged in, right-click on the server and select "properties" - you can then change the name of the role you want to use to login.) This should establish whether it is a permissions problem.

Another thing I did was to log in to the warehouse website and then went to

http://testwarehouse.indicia.org.uk/index.php/services/data/taxon_image/18.

That returned the following to my browser

<taxon_image>
  <id>18</id>
  <path>1361186248342.jpg</path>
  <caption>Grey Squirrel copyright Tom Ennis</caption>
  <deleted>f</deleted><taxon_meaning_id>45043</taxon_meaning_id>
</taxon_image>

Jim Bacon

3

Re: error accessing table

Hi Jim

These tests do work when I'm logged on to the warehouse and as you demonstrate, all goes to plan. But although I can return the user_id through autheticate_user which shows I'm logged onto the warehouse I still had no access to the entity. I did what I think is possibly a rather bad thing and changed this in the service array to allow_full_access for taxon_image. No idea what the consequences of this may be, but it does appear to need at least something (perhaps a bit more controlled than my effort) along these lines to get it to work.

Thanks for the pointers.

Ta

Iain

4

Re: error accessing table

Hi Iain

I did a search on the warehouse code for "No access to entity" and found it in DataController::build_query_results() which is in file modules/indicia_svc_data/controllers/services/data.php.

A comment in the code there says "If not in the warehouse, then the entity must explicitly allow full access, or contain a website ID to filter on."

Since the database view, detail_taxon_images, does not contain a website_id field the alternative of adding taxon_image to the allow_full_access is certainly a solution.

Is it reasonable? What it does is to allow any website access to any taxon image. Since taxa_taxon_list is also allowing full access, so any website can use any taxon list, it is a consistent level of access. I wouldn't say this is particularly bad, although it does conflict with the notion that species lists are owned by a website unless created by a warehouse administrator explicitly for use by all sites.

Anyway, I think you can credit yourself with having found and fixed a bug. Perhaps John can review it and commit it if he considers it correct.

Jim Bacon.

5

Re: error accessing table

Agreed and done, thanks!

John van Breda
Biodiverse IT