Field Permissions (hide / lock fields by usergroup)

Got something cool to share with AppGini users? Feel free to post it here!
User avatar
lramirez
Veteran Member
Posts: 64
Joined: 2019-11-01 23:23

Re: Field Permissions (hide / lock fields by usergroup)

Post by lramirez » 2024-01-24 20:06

Hello Olaf,
excuse my English..
I have observed that in the latest versions of AppGini 23, something happens in the FIELD PERMISSIONS configurations (V1.15) and it does not block the fields, it just hides them, sometimes yes or sometimes no. Could it be something that was reconfigured? :cry:

thank you for your time
Luis Ramirez R.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Field Permissions (hide / lock fields by usergroup)

Post by onoehring » 2024-02-06 10:26

Hi,
I want to apologize for not seeing your replies sooner.

@urichard: If i remember correct: yes, you do need Jan's add on.

@lramirez: Thanks for letting me know. I might check this out in the next couple of days, but I will test only on the latest AG (24.10 rev 1579). It does not make sense to test older software.
It may depend on the field type. Can you please post more details where what problems occur. Thanks.

Olaf

hannah.kkp
Posts: 2
Joined: 2024-09-18 10:34

Re: Field Permissions (hide / lock fields by usergroup)

Post by hannah.kkp » 2024-10-21 03:40

Hello Olaf and friends!
I've new to the forums but have been using appgini for a few years.
I'm not the best coder but I've made do with appgini throughout the years but I seriously need some help this time. :(
I've been trying to implement field permissions and have tried every version with a similar problem.
I have reset my database and redone it step-by-step multiple times!

View_membership_groups = Good
but my tmp_tables_fields table is empty and so my db_field_permissions won't load.

If I don't do step 5 and erase/remove these:
Image

Code: Select all

<?php
//Field Permissions Code
if (!function_exists('fill_tmp_tables_fields')) {
	include("hooks/field_permission_tmp.php");
	}
	// For help on using hooks, please refer to https://bigprof.com/appgini/help/advanced-topics/hooks/

	function db_field_permission_init(&$options, $memberInfo, &$args) {
		fill_tmp_tables_fields();
		return TRUE;
	}

Then the db_field_permissions table will load but the tmp_tables_fields is still blank.
Image
Image


I ran these sql and everything seems to be fine in the backend. (photos attached)

Code: Select all

SHOW FULL TABLES WHERE table_type = 'BASE TABLE';

Code: Select all

SHOW COLUMNS FROM BStandards
Image
Image

Is there something wrong with the calling of my function fill_tmp_tables_fields(){
or
am I doing something wrong?

Please help I'm stressing! I believe the field settings are a bit off as well but i don't think it's causing this issue.
Image

I've read through the others comments but couldn't find a solution. (I believe "ckebbell" back in 2020 may have had a similar issue but the solution was not posted.)

V.1.21 field permissions script with Appgini 24.17

Thank You.
(Also, I'm a big fan of all of the appgini team and am excited to finally be able to post and advance. Thank you for your time and all your continued hard work!)

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 353
Joined: 2018-03-04 09:30
Location: David

Re: Field Permissions (hide / lock fields by usergroup)

Post by D Oliveira » 2024-10-23 17:07

Try chaging updateDB.php directly, edit the column definitions in the php file and appgini will be happy

hannah.kkp
Posts: 2
Joined: 2024-09-18 10:34

Re: Field Permissions (hide / lock fields by usergroup)

Post by hannah.kkp » 2024-10-23 18:47

Hi D Oliveira,

I'm assuming you mean for me to edit this code for the tmp_tables_fields.

Code: Select all

		setupTable('view_membership_groups', [
				" ALTER TABLE `view_membership_groups` CHANGE `allowSignup` `allowSignup` TINYINT NULL ",
				" ALTER TABLE `view_membership_groups` CHANGE `allowSignup` `allowSignup` TINYINT(4) NULL ",
				" ALTER TABLE `view_membership_groups` CHANGE `needsApproval` `needsApproval` TINYINT NULL ",
				" ALTER TABLE `view_membership_groups` CHANGE `needsApproval` `needsApproval` TINYINT(4) NULL ",
				" ALTER TABLE `view_membership_groups` CHANGE `name` `name` VARCHAR(100) NULL ",
				"ALTER TABLE `view_membership_groups` DROP INDEX `name_unique`",
				" ALTER TABLE `view_membership_groups` CHANGE `groupID` `groupID` INT(10) NOT NULL ",
				" ALTER TABLE `view_membership_groups` CHANGE `groupID` `groupID` INT(10) UNSIGNED NOT NULL ",
				" ALTER TABLE `view_membership_groups` CHANGE `groupID` `groupID` INT(10) UNSIGNED NOT NULL DEFAULT '0' ",
			]);

		setupTable('tmp_tables_fields', []);

		setupTable('db_field_permission', []);
		setupIndexes('db_field_permission', ['groupID','table_field',]);

Unfortunately, I am unsure how I am supposed to edit the tmp_tables_fields to call my table fields.. as the script is supposed to do.
Could you maybe elaborate on how I can solve this?


I even tried to alter view_membership_groups in the updateDB.php to match the database definitions, to not avail. I don't know why it says I have 2 errors to fix. but the pdf says to have groupID as the primary key so I'm just going to leave it for now.
Image

I've reentered Step 5 into my db_field_permissions.php and it is still not loading as shown.
Image
TMP FIELDS not called.
Image

Any advice would be much appreciated!
Thanks!!
Hannah

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1202
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Field Permissions (hide / lock fields by usergroup)

Post by onoehring » 2024-10-23 22:43

Hi Hannah and all,

currently I can not take part in solving the problem, sorry. I am following this thread however and will post once I have the chance to try myself.
Olaf

Post Reply