Field Permissions (hide / lock fields by usergroup)
Field Permissions (hide / lock fields by usergroup)
Hi
as AppGini (AG) in the current version 5.81 does not support field specific permissions, I decided to make a start.
I present documentation and code to implement field specific permissions in your own AG application: You can easily LOCK and HIDE fields for specific usergroups. Single users are not supported at this time.
Please see the attached ZIP which contains a PDF with instructions and the code needed.
Installation time: approx. 30 minutes (my guess - please let me know how long it actually took you)
This solution implements a frontend hiding and locking as well as a backend checking. If a users tries to cheat and fiddles around in the code of the page to change values he actually does not have access to (hidden/locked fields) the attempt to save the changes will fail.
Important
This Field Permissions extension requires AppGini Helper! You need to buy AppGini Helper which can be obtained for small money from https://www.bizzworxx.de/en/appgini-helper/
I decided to use Appgini Helper as it is a great script which supports all field types of AppGini and provides many new features to AppGini (AG Forum: viewtopic.php?f=2&t=3206). Please take a look and support Jan Setzer (Â jsetzer, memberlist.php?mode=viewprofile&u=9279Â ) who is the programmer and great supporter of all users in the AppGini forum.
Look of locked fields: Additional contents in your AG application: Permission definition A: Permission definition B: Download Please post your suggestions and comments, as well as any errors I made in the documentation so that i can correct them.
Olaf
as AppGini (AG) in the current version 5.81 does not support field specific permissions, I decided to make a start.
I present documentation and code to implement field specific permissions in your own AG application: You can easily LOCK and HIDE fields for specific usergroups. Single users are not supported at this time.
Please see the attached ZIP which contains a PDF with instructions and the code needed.
Installation time: approx. 30 minutes (my guess - please let me know how long it actually took you)
This solution implements a frontend hiding and locking as well as a backend checking. If a users tries to cheat and fiddles around in the code of the page to change values he actually does not have access to (hidden/locked fields) the attempt to save the changes will fail.
Important
This Field Permissions extension requires AppGini Helper! You need to buy AppGini Helper which can be obtained for small money from https://www.bizzworxx.de/en/appgini-helper/
I decided to use Appgini Helper as it is a great script which supports all field types of AppGini and provides many new features to AppGini (AG Forum: viewtopic.php?f=2&t=3206). Please take a look and support Jan Setzer (Â jsetzer, memberlist.php?mode=viewprofile&u=9279Â ) who is the programmer and great supporter of all users in the AppGini forum.
Look of locked fields: Additional contents in your AG application: Permission definition A: Permission definition B: Download Please post your suggestions and comments, as well as any errors I made in the documentation so that i can correct them.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Re: Field Permissions (hide / lock fields by usergroup)
Hi,
a small update. I noticed, if you include the code, but do not have any fields in that table that are hidden / locked, you get a JS error. This has been fixed in this version 1.1.
Download Olaf
a small update. I noticed, if you include the code, but do not have any fields in that table that are hidden / locked, you get a JS error. This has been fixed in this version 1.1.
Download Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Re: Field Permissions (hide / lock fields by usergroup)
Thanks for sharing
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf
Thank you for this wonderful mod (which is really useful to me!)
I have tried to implement it in my application but I don't get anything appear in the field list? The user groups list appears correctly but there are no matches in the tables / fields dropdown. I have attached 2x screenshots, 1 of the table as shown in my local testing environment and 1 of the appgini app (to make sure I got the fields right!) I have followed the PDF instructions step by step (twice, just to make sure I didn't get anything wrong the first time!) so I am not sure what I am doing wrong? Has this happened to anyone else and can anyone help me with a possible solution?
Thank you for this wonderful mod (which is really useful to me!)
I have tried to implement it in my application but I don't get anything appear in the field list? The user groups list appears correctly but there are no matches in the tables / fields dropdown. I have attached 2x screenshots, 1 of the table as shown in my local testing environment and 1 of the appgini app (to make sure I got the fields right!) I have followed the PDF instructions step by step (twice, just to make sure I didn't get anything wrong the first time!) so I am not sure what I am doing wrong? Has this happened to anyone else and can anyone help me with a possible solution?
Re: Field Permissions (hide / lock fields by usergroup)
Hi ckebbell,
thanks for asking for help. You are the first one to ask anything, so there might be a mistake in my PDF. We both will try to figure it out.
Did you do step 5 of the PDF?
The problem seems to be
a) you did not add this to the _init part of the file or
b) some other reason.
I suppose b) - as you said you followed instructions.
Please try to open the tmp_tables_fields table with phpmyadmin (or a similar tool) and see, if the field table_field has some contents.
If not, please try to run some SQL (from phpmyadmin) to see what happens - and if there is a mistake (please report here).
First run this SQL - it should list all tables in your database:
Then, please run this SQL (I added your tablename BStandards to make this example work). If should show all fields in your table:
Maybe it helps, when you post screenshots of the SQL output (header + 1 or 2 rows maybe).
So, what happens?
Olaf
thanks for asking for help. You are the first one to ask anything, so there might be a mistake in my PDF. We both will try to figure it out.
Did you do step 5 of the PDF?
In 5.1 the file field_permission_tmp.php gets included where function fill_tmp_tables_fields is placed. This function is prepared in step 5.2: By calling the function the table tmp_tables_fields should be filled.Step 5
Adjust /hooks/db_field_permission.php (created by generating your code)
Step 5.1
Open the file and add directly after the opening with <?php this code:
//Field Permissions Code
if (!function_exists('fill_tmp_tables_fields')) {
    include("hooks/field_permission_tmp.php");
}
This way we make sure the list of tables and fields you can choose from in this table is always regenerated when this file is accessed.
Step 5.2
Look for the function ..._init and
before the line return TRUE; add this line of code:
fill_tmp_tables_fields();
The problem seems to be
a) you did not add this to the _init part of the file or
b) some other reason.
I suppose b) - as you said you followed instructions.
Please try to open the tmp_tables_fields table with phpmyadmin (or a similar tool) and see, if the field table_field has some contents.
If not, please try to run some SQL (from phpmyadmin) to see what happens - and if there is a mistake (please report here).
First run this SQL - it should list all tables in your database:
Code: Select all
SHOW FULL TABLES WHERE table_type = 'BASE TABLE';
Code: Select all
SHOW COLUMNS FROM BStandards
So, what happens?
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf
Thank you so much for replying! I have taken screenshots of each part so you can check whether I have done it correctly? I am not sure whether I have carried out Step 2 correctly and will post screenshots in a separate post.
Steps 5.1 and 5.2: SQL to show Base Tables: View of tmp_tables_field SQL to show columns in an example table:
Thank you so much for replying! I have taken screenshots of each part so you can check whether I have done it correctly? I am not sure whether I have carried out Step 2 correctly and will post screenshots in a separate post.
Steps 5.1 and 5.2: SQL to show Base Tables: View of tmp_tables_field SQL to show columns in an example table:
Re: Field Permissions (hide / lock fields by usergroup)
So this is Step 2, carried out on the Sites table. I am hoping this part is correct? I wasn't sure whether I had to replace tablename with the name of the table, so this is why I am not confident that this part is correct!
Footer edits: beforeupdate eit:
Footer edits: beforeupdate eit:
-
- Posts: 7
- Joined: 2015-03-25 13:10
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf
Thank you for your wonderful work.
Everything works fine for me in detail view mode, while in table mode I still view fields checked as "hidden" in the db_field_permissions table: have you got any suggestions to solve the problem? (I have inserted step 2.2b code in tableview, detailview and tableview+detailview).
I think that there is a little mistake in the pdf guide, step 3.4: groupID is simply defined as (Integer, VarChar), while I defined it as integer, setting it to Lookup Field and choosing as Parent table view_membership_groups and as Parent caption field part 1 name.
Thank you again, Paolo
Thank you for your wonderful work.
Everything works fine for me in detail view mode, while in table mode I still view fields checked as "hidden" in the db_field_permissions table: have you got any suggestions to solve the problem? (I have inserted step 2.2b code in tableview, detailview and tableview+detailview).
I think that there is a little mistake in the pdf guide, step 3.4: groupID is simply defined as (Integer, VarChar), while I defined it as integer, setting it to Lookup Field and choosing as Parent table view_membership_groups and as Parent caption field part 1 name.
Thank you again, Paolo
Re: Field Permissions (hide / lock fields by usergroup)
Hello, I was reading the other php files to see if I could find anything that might give me a clue. I found that there is a section grayed out in field_permission_base.php
I am now going to look at field_permission_tmp to see if I can see anything...
Should it look like this?
Although I am still unable to see any tables.fields, I was wondering whether this might be part of it?I am now going to look at field_permission_tmp to see if I can see anything...
Re: Field Permissions (hide / lock fields by usergroup)
Hi Paolo,
thank you for reporting the error in the PDF. You are correct, I checked with my AG file. The description in 3.4 for groupID should be
Download v 1.14
Sorry, PDF was to large for uploading, please download from here: https://dl.olaf-noehring.de/?t=640be0ec ... 399f112b99
@Paolo: I missed that in my (old) PDF: LOCK and HIDE are applied in Detailview (where users normally are able to edit the data), but not in Tableview (only listing the data as a table) at this time. Sorry for that. But it's an idea I will keep in mind and get on when I find some time.
@ckebbell: Please redo step 3.4 ad described above. Maybe this solves your problem already.
The screenshot of Steps 5.1 and 5.2 looks correct.
The screenshot of SQL to show Base Tables seems to show the correct information - so the permission-script is able to read all tables from your database.
The screenshot of SQL to show columns in an example table also looks correct.
The screenshot of View of tmp_tables_field does not look correct. The table should be empty only before the db_field_permission.php has been run the first time. At this time (as in your screenshot of steps 5.1 and 5.2 correctly set) in the _init function of the file the command fill_tmp_tables_fields() should fill that tmp_tables_field table.
For your screenshot Sites.JPG, I appologize for not being clear enough in the PDF description. I tried to update this in the current version:
You did nothing wrong here: You correctly copied the code from the documentation. I suppose you mean $options->TableName; - here TableName is a variable which does not need to be changed as it is handled by code
The other screenshots of your 2nd posting seem ok at first glance.
Yes, the greyed out part is correct. There the php variable $extraJS_Disable_Field_Timer is defined. The grey stuff is the contents of that variable, the pad_field_permissions ... is again php code which inserts the list of locked fields as comma seperated valued into that variable where each value is included in " . Example: "firstfield","secondfield"
I believe redoing step 3.4 will not solve the problem, but please try. What version of PHP and MySQL are you using?
I have attached a special file you (ckebbell) you for testing: field_permission_tmp_TEST.zip. If step 3.4 does not solve your issue, please try the following:
1. Download field_permission_tmp_TEST.zip and extract.
2. Rename extracted file to field_permission_tmp.php (name is now same as in the "real" field-permissions).
3. Upload this new file to the /hooks directory and overwriting the existing file.
4. Please open the db_field_permissions in your browser as you have done before.
5. The new file fill be called and create a file app.log either in your hooks or your root directory.
6. Please send me that log file in a PN, I will take a look how far the script handles the data and where it fails. (The app.log is a simple text file, you can check it out using notepad++).
Olaf
thank you for reporting the error in the PDF. You are correct, I checked with my AG file. The description in 3.4 for groupID should be
Which looks like this I am attaching an updated version.groupID (Integer). Set this to Lookup Field and choose as Parent table view_membership_groups and as Parent caption field part 1 name.
Download v 1.14
Sorry, PDF was to large for uploading, please download from here: https://dl.olaf-noehring.de/?t=640be0ec ... 399f112b99
@Paolo: I missed that in my (old) PDF: LOCK and HIDE are applied in Detailview (where users normally are able to edit the data), but not in Tableview (only listing the data as a table) at this time. Sorry for that. But it's an idea I will keep in mind and get on when I find some time.
@ckebbell: Please redo step 3.4 ad described above. Maybe this solves your problem already.
The screenshot of Steps 5.1 and 5.2 looks correct.
The screenshot of SQL to show Base Tables seems to show the correct information - so the permission-script is able to read all tables from your database.
The screenshot of SQL to show columns in an example table also looks correct.
The screenshot of View of tmp_tables_field does not look correct. The table should be empty only before the db_field_permission.php has been run the first time. At this time (as in your screenshot of steps 5.1 and 5.2 correctly set) in the _init function of the file the command fill_tmp_tables_fields() should fill that tmp_tables_field table.
For your screenshot Sites.JPG, I appologize for not being clear enough in the PDF description. I tried to update this in the current version:
Step 2
Open the each file that belongs to a table where you want to use field permissions from the hooks folder in an editor and make the following adjustments in each table. Example: If you have a table named customers, you have to edit the file /hooks/customers.php. For the table articles, you will need to edit the file /hooks/articles.php
You did nothing wrong here: You correctly copied the code from the documentation. I suppose you mean $options->TableName; - here TableName is a variable which does not need to be changed as it is handled by code
The other screenshots of your 2nd posting seem ok at first glance.
Yes, the greyed out part is correct. There the php variable $extraJS_Disable_Field_Timer is defined. The grey stuff is the contents of that variable, the pad_field_permissions ... is again php code which inserts the list of locked fields as comma seperated valued into that variable where each value is included in " . Example: "firstfield","secondfield"
I believe redoing step 3.4 will not solve the problem, but please try. What version of PHP and MySQL are you using?
I have attached a special file you (ckebbell) you for testing: field_permission_tmp_TEST.zip. If step 3.4 does not solve your issue, please try the following:
1. Download field_permission_tmp_TEST.zip and extract.
2. Rename extracted file to field_permission_tmp.php (name is now same as in the "real" field-permissions).
3. Upload this new file to the /hooks directory and overwriting the existing file.
4. Please open the db_field_permissions in your browser as you have done before.
5. The new file fill be called and create a file app.log either in your hooks or your root directory.
6. Please send me that log file in a PN, I will take a look how far the script handles the data and where it fails. (The app.log is a simple text file, you can check it out using notepad++).
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf
Thank you so much for your detailed answer
I am carrying out testing in a local environment, so I can wipe everything and generate a brand new version tonight. It may be that because I had already generated the app and carried out some work (uploading data via csv, changing some hooks) that maybe the addition of the HideFields mod didn't work correctly?
I had already guessed the steps mentioned by Paolo above (the field type and caption) so mine looks the same in Appgini.
There is no attachment called field_permission_tmp_TEST.zip that I can see to download in your post? I have downloaded the v1.14 but it looks like just a PDF? I will try re-generating anyway and if that doesn't work I will try the log file and send to you (if you can please upload it?)
I am using PHP 7.1.1 and MySQL 5.6.34 (latest version of xampp, I think?)
Thank you!
Thank you so much for your detailed answer
I am carrying out testing in a local environment, so I can wipe everything and generate a brand new version tonight. It may be that because I had already generated the app and carried out some work (uploading data via csv, changing some hooks) that maybe the addition of the HideFields mod didn't work correctly?
I had already guessed the steps mentioned by Paolo above (the field type and caption) so mine looks the same in Appgini.
There is no attachment called field_permission_tmp_TEST.zip that I can see to download in your post? I have downloaded the v1.14 but it looks like just a PDF? I will try re-generating anyway and if that doesn't work I will try the log file and send to you (if you can please upload it?)
I am using PHP 7.1.1 and MySQL 5.6.34 (latest version of xampp, I think?)
Thank you!
Re: Field Permissions (hide / lock fields by usergroup)
Hi,
sorry, forgot to upload the test file See attachment to this post.
Olaf
sorry, forgot to upload the test file See attachment to this post.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
-
- Posts: 7
- Joined: 2015-03-25 13:10
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf,
to hide fields in table view I have followed the procedure I found here: https://bigprof.com/blog/appgini/how-to ... ser-group/
Probably it's not the best way to solve the problem, but it's enough for my needs at the moment.
Thanks, Paolo
to hide fields in table view I have followed the procedure I found here: https://bigprof.com/blog/appgini/how-to ... ser-group/
Probably it's not the best way to solve the problem, but it's enough for my needs at the moment.
Thanks, Paolo
onoehring wrote: ↑2020-01-31 09:58@Paolo: I missed that in my (old) PDF: LOCK and HIDE are applied in Detailview (where users normally are able to edit the data), but not in Tableview (only listing the data as a table) at this time. Sorry for that. But it's an idea I will keep in mind and get on when I find some time.
Re: Field Permissions (hide / lock fields by usergroup)
Hi Paolo,
thanks for pointing this out. I will try to implement it, but I am working on a small update for some other software I am offering for free: PowerPoint Progress Indicator (maybe this can be of use for someone here ). Once that update is done, I will get on the field permissions again.
Olaf
thanks for pointing this out. I will try to implement it, but I am working on a small update for some other software I am offering for free: PowerPoint Progress Indicator (maybe this can be of use for someone here ). Once that update is done, I will get on the field permissions again.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Re: Field Permissions (hide / lock fields by usergroup)
Hi Paolo,
I have read the blog post, and I am not sure if I will (try to) use that or simply do a JS solution. The problem I see with this post is, that it seems the field-permissions-script would need to regenerate/copy a lot of files for an application.
I must admit, that I developed the script for a closed user group where certain users should have more permissions than other and hiding fields might make editing for some groups easier. Thus I did not care to much about hiding fields directly on the serverside, but just hiding them with JS. Every user could open the console /html and still see original data. A change of locked data is not possible as this is checked on the backend when the users tries to save.
As I tried to make field-permissions universal, I will probably not use the approach described in the blog. Maybe, just maybe - if I decided to walk this way, I might combine the blog approach with JS: I could hide data using JS and replace this data before publishing it on the page. Instead of the customer ID the data in that column might be "0", and JS hides that column. This way, noone could see actual data even when looking at the code. No other files would need to be changed installing the field-permissions script. .... Well, did I explain this in an understandable way? I hope so.
Olaf
I have read the blog post, and I am not sure if I will (try to) use that or simply do a JS solution. The problem I see with this post is, that it seems the field-permissions-script would need to regenerate/copy a lot of files for an application.
I must admit, that I developed the script for a closed user group where certain users should have more permissions than other and hiding fields might make editing for some groups easier. Thus I did not care to much about hiding fields directly on the serverside, but just hiding them with JS. Every user could open the console /html and still see original data. A change of locked data is not possible as this is checked on the backend when the users tries to save.
As I tried to make field-permissions universal, I will probably not use the approach described in the blog. Maybe, just maybe - if I decided to walk this way, I might combine the blog approach with JS: I could hide data using JS and replace this data before publishing it on the page. Instead of the customer ID the data in that column might be "0", and JS hides that column. This way, noone could see actual data even when looking at the code. No other files would need to be changed installing the field-permissions script. .... Well, did I explain this in an understandable way? I hope so.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
- aarlauskas
- Veteran Member
- Posts: 127
- Joined: 2019-04-28 18:03
- Location: Medway, UK
Re: Field Permissions (hide / lock fields by usergroup)
I'm pulling my last hair out... Why is this not working for me All the new created tables displays groups, tables and fields, DB Field Permission feels like doing its job, lets you select field, select option lock/hide, but nothing really locks or hides for the selected field. It looks like really insane job done by Olaf and I wish I could get this to work.. Such a great tool. I have followed the PDF several times, tried in local mode and uploaded on hosting server where my site is, still no luck. Please help, I want this so bad
Thanks Olaf.
Thanks Olaf.
Re: Field Permissions (hide / lock fields by usergroup)
Hi aarlauskas,
before you are getting balled, tell me some details, what does when not work?
Please note, that the hide/lock at this time do only work in detail view of the table (or in table+detail) - but not in the "table"-part. This has been described and is on my todo list.
If I understand you correct, you do see the table*field list where you can choose hide/lock for the fields.
Did you touch all files where the field permissions should be set / put to work and insert the code as described in the latest docs (1.14)?
Have you purchased the AppGini Helper from jsetzer?
So, fields do not hide in detail view?
And fields do not lock in detail view?
Did you try to remove all files from the server and upload all of them again? Did you clear your browser cache and did you try another browser?
What php version are you using? I have tested it on php7.something.
Olaf
before you are getting balled, tell me some details, what does when not work?
Please note, that the hide/lock at this time do only work in detail view of the table (or in table+detail) - but not in the "table"-part. This has been described and is on my todo list.
If I understand you correct, you do see the table*field list where you can choose hide/lock for the fields.
Did you touch all files where the field permissions should be set / put to work and insert the code as described in the latest docs (1.14)?
Have you purchased the AppGini Helper from jsetzer?
So, fields do not hide in detail view?
And fields do not lock in detail view?
Did you try to remove all files from the server and upload all of them again? Did you clear your browser cache and did you try another browser?
What php version are you using? I have tested it on php7.something.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
- aarlauskas
- Veteran Member
- Posts: 127
- Joined: 2019-04-28 18:03
- Location: Medway, UK
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf. Yes you do understand correct, the interface seems like its fine, you can see the tables*fields, select lock/hide, then log on with the user in that ‘locked/hidden’ group, but they can still do anything they like with this field. I did try all suggestions from here, but the result is the same. I did this now for the fifth time, generated new test app, uploaded into empty directory, nothing.
I did follow your latest 1.14 doc.
All configured as per your script (I think the instructions are very clear).
I have Appgini Helper from Jan.
I don’t care about Table View.
PHP Version 7.3
Tried different browsers, clearing cache, refreshing etc.
I know the Appgini Helper is working as I do use some of the Jans code in same tables.
I was just thinking, could it be the older Appgini Helper that you configured your script on? Based on Jans log he did change the name of the helper and that also happened 11.2019, the same sort of time you published you script here? Interface I can use the below, (not sure if its yours or P. Botchers) to hide some fields manually, but it only does text field.. So your solution would be Game Changer if it worked.
Thanks Olaf.
I did follow your latest 1.14 doc.
All configured as per your script (I think the instructions are very clear).
I have Appgini Helper from Jan.
I don’t care about Table View.
PHP Version 7.3
Tried different browsers, clearing cache, refreshing etc.
I know the Appgini Helper is working as I do use some of the Jans code in same tables.
I was just thinking, could it be the older Appgini Helper that you configured your script on? Based on Jans log he did change the name of the helper and that also happened 11.2019, the same sort of time you published you script here? Interface I can use the below, (not sure if its yours or P. Botchers) to hide some fields manually, but it only does text field.. So your solution would be Game Changer if it worked.
Code: Select all
function table_name_footer($contentType, $memberInfo, &$args){
$footer='';
switch($contentType){
case 'tableview':
//$footer='';
if ($memberInfo['group'] != 'Admins') {
$footer="<%%FOOTER%%><script>\$j('#field_name,#site_name').attr('readonly','true')</script>";
}
else $footer='';
break;
case 'detailview':
//$footer='';
if ($memberInfo['group'] != 'Admins') {
$footer="<%%FOOTER%%><script>\$j('#field_name,#site_name').attr('readonly','true')</script>";
}
else $footer='';
break;
case 'tableview+detailview':
//$footer='';
if ($memberInfo['group'] != 'Admins') {
$footer="<%%FOOTER%%><script>\$j('#field_name,#site_name').attr('readonly','true')</script>";
}
else $footer='';
break;
case 'print-tableview':
$footer='';
break;
case 'print-detailview':
$footer='';
break;
case 'filters':
$footer='';
break;
}
return $footer;
}
Re: Field Permissions (hide / lock fields by usergroup)
Hi aarlauskas,
please try the following
open field_permission_base.php with your editor
Search for
(somewhere in the end of the file, last couple of lines)
replace the complete line with this
Does it work now?
If yes, I will post a new version for all others.
Olaf
please try the following
open field_permission_base.php with your editor
Search for
Code: Select all
$extraJS_Start . "\n\n\n" . $extraJS_End){
replace the complete line with this
Code: Select all
if ($extraJS_field_permission == $extraJS_Start . "\n\n\n" . $extraJS_End){
If yes, I will post a new version for all others.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
- aarlauskas
- Veteran Member
- Posts: 127
- Joined: 2019-04-28 18:03
- Location: Medway, UK
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf, YES IT DOES!!!!! Happy Days. That gives totaly new face for our Appgini! Thanks a lot for this! The below is your fantastic script in action. Locking or hiding lookup fields , Finally.
https://youtu.be/rZAZIOERcRc
https://youtu.be/rZAZIOERcRc
Re: Field Permissions (hide / lock fields by usergroup)
Hi aarlauskas,
thanks for the feedback and for screencasting.
For all here is the new version. I missed a small - but important - bug so far. Instead of doing == I only did = in a php comparison. Sorry for that.
For everyone who is using the add-on already: You can simply upgrade by replacing the old files from the plugin with the files in the new downloadable zip.
For all people new to this plugin, simply download and follow installation instructions
Download 1.15
Sorry, file to large for uploading, so please download here: https://dl.olaf-noehring.de/?t=f86b6659 ... 06ab9ee98e
Olaf
thanks for the feedback and for screencasting.
For all here is the new version. I missed a small - but important - bug so far. Instead of doing == I only did = in a php comparison. Sorry for that.
For everyone who is using the add-on already: You can simply upgrade by replacing the old files from the plugin with the files in the new downloadable zip.
For all people new to this plugin, simply download and follow installation instructions
Download 1.15
Sorry, file to large for uploading, so please download here: https://dl.olaf-noehring.de/?t=f86b6659 ... 06ab9ee98e
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Re: Field Permissions (hide / lock fields by usergroup)
Olaf,
I have created all the relevant files and uploaded accordingly, but when i get to the "ReadySetGo" part all i get is a blank screen in different web browsers
any thoughts or ideas would be most welcome
Thank you
I have created all the relevant files and uploaded accordingly, but when i get to the "ReadySetGo" part all i get is a blank screen in different web browsers
any thoughts or ideas would be most welcome
Thank you
Re: Field Permissions (hide / lock fields by usergroup)
Hi,
please give some more details, so that we can tap forward to finding the solution and we are not searching the needle in a haystack.
AppGini
MySQL
PHP
Olaf
please give some more details, so that we can tap forward to finding the solution and we are not searching the needle in a haystack.
- Did you follow all instructions?
- Some more detailed things to check:Did you clear your browser cache?
- Do you have the AppGini Helper plugin from Jan (it is not needed to define lock/hidden, but to actually not show the hidden/locked fields)?
- Are the needed files (step 1) in your /hooks folder?Please check (using phpmyadmin or similar), that the tables from your AG application have been generated and that the view (step 3) is there.
- Did you create your AG application (Step 4) and then made the changes as described in step 5?
- You you have permissions (AG) to access the db_field_permission table?
AppGini
MySQL
PHP
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
- aarlauskas
- Veteran Member
- Posts: 127
- Joined: 2019-04-28 18:03
- Location: Medway, UK
Re: Field Permissions (hide / lock fields by usergroup)
Hi Olaf, just a very quick one (not an issue), I have a 'Traffic Lights'' in table view, it changes the color of the row based on field value. I have noticed when applying Lock status on the field (not the one that is assigned to Traffic Lights), it kills the script, no more colors in that row. I have deleted the code in table_name_footer from Tableview line and that seems to be ok now. This is not really required as there is no change to table view anyway. Thanks again for your hard work here
Now all ok.
Now all ok.
Re: Field Permissions (hide / lock fields by usergroup)
Hi aarlauskas,
good point. I did not think about this, but you are correct. At this time it does not matter for the table-view at all - I am planning to implement some comment from above, so that hidden fields are actually hidden in table view as well. Then it might matter.
But still strange. I have something similar in a table and the field-permissions does not kill the JS formating
I am using this
in hooks/tablename-tv.js to add a css class to each row. The class is different (ebene_1, ebene_2 etc.), depending on the value in the field ID_posZ
Looks like this: Strange.
Olaf
good point. I did not think about this, but you are correct. At this time it does not matter for the table-view at all - I am planning to implement some comment from above, so that hidden fields are actually hidden in table view as well. Then it might matter.
But still strange. I have something similar in a table and the field-permissions does not kill the JS formating
I am using this
Code: Select all
//Farbige Hintergründe abhängig vom Feldinhalt (ID_posZ)
$j(function () {
$j('.ecomo_container-ID_posZ').each(function(){
var ebene = $j(this).text();
var new_CSS_basename = "ebene_";
var new_CSS_class = new_CSS_basename.concat(ebene);
$j(this).parents('tr').addClass(new_CSS_class);
})
});
Looks like this: Strange.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button