Page 1 of 1
Search Crashes when searching Views using global-search.php
Posted: 2020-10-30 05:49
by mohamed
Hello,
I am using Global-Search.php from
https://gist.github.com/bigprof/1dc6bc2 ... c48c2a4cc7
The problem, it crashes when searching a VIEW table
The error:
unknown column 'View_ADSL.' in 'field list'
Query:
SELECT `View_ADSL`.`` as 'PRIMARY_KEY_VALUE', `View_ADSL`.`id` as 'id', `View_ADSL`.`Site` as 'Site', .....
** I am creating VIEWs as follows:
1. Create VIEW in MySQL
2. Create a Table in AppGini with same name and fields details
**
1.
Am I using VIEWs with AppGini in the correct way ?
2.
Any clue about such crash ?
Re: Search Crashes when searching Views using global-search.php
Posted: 2020-10-30 16:45
by pfrumkin
To create a view I have done the following:
1) Create the table in my AG project, generate
2) Drop table in SQL
3) Create view in SQL
When adding/removing columns, you have to drop the view, then generate the site, allowi the automation to recreate the table, then drop the table and create the view.
I have found it a little klunky that we have to drop the view when changing the original table schema but I see why. Creating the view this way is a little kludgy to begin with. That would be a nice feature to add in AG, but I can see it's fraught with complications.
Re: Search Crashes when searching Views using global-search.php
Posted: 2020-10-31 10:01
by mohamed
Hi pfrumkin,
Actually, I was trying to use the view by hiding the original table from an end user.
BUT
I am not sure if I can hide original tables in Global Search, i.e., the end user can only Search the View that he has rights to view !
Re: Search Crashes when searching Views using global-search.php
Posted: 2020-11-01 19:07
by pfrumkin
I had not considered that as a problem but perhaps it is. The rights to the view in AG are simply the rights to the (view) table on which it is based - AG doesn't know it's a view, thinks it's the original table. But I see your point, SQL may impose it's own access control on the view based on the tables that define the view. It seems that should be a power of SQL views, to provide access to data in a view of tables that they otherwise would not have access. And I think AG does manage all the access at the AG table level, not internally in SQL.
All that said I haven't tested this so I'm speculating.
Re: Search Crashes when searching Views using global-search.php
Posted: 2020-11-07 07:15
by mohamed
Yes you are right, AppGini treat VIEW tables like any other table, that's why I was able to link the VIEW tables to AppGini. The good think, I have managed to find a workaround to solve the search through VIEW tables
Re: Search Crashes when searching Views using global-search.php
Posted: 2021-11-14 04:34
by sacgtdev
Hi mohamed,
I have similar objective as yours which is to allow user to view records which are inaccessible to them in the actual table.
I think we can create the view for each table and edit the global-search.php where:
/* get tables accessible by current user */
//$tables = getTableList();
//changed the above line with a custom-array for $tables = {'view1', 'view2'};
Check to check whether you are also having the similar solution.. Btw, above code have not tested yet.