Page 1 of 1
Custom Hook
Posted: 2020-11-10 02:28
by utony
Anyone know how to write a custom hook to turn off add, edit and delete rights for a group at a certain time? I want to allow a group to add, edit, and delete a record up to certain time and then I want the table to go to a read only mode for the users in a group.
Any help would be great!
Re: Custom Hook
Posted: 2020-11-13 07:23
by onoehring
Hi,
you should be able to use the options->.... in the ..._init function of /hooks/tablename
Let's say your groups (that have the permissions to add, update, delete) are GROUP_1_THAT_HAS_PERMISSIONS and GROUP_2_THAT_HAS_PERMISSIONS (code not tested):
Code: Select all
if (in_array($memberInfo['group'], array('GROUP_1_THAT_HAS_PERMISSIONS','GROUP_2_THAT_HAS_PERMISSIONS'))) {
$options->AllowDelete= 1;
$options->AllowInsert= 1;
$options->AllowUpdate= 1;
} else {
$options->AllowDelete= 0;
$options->AllowInsert= 0;
$options->AllowUpdate= 0;
}
also see
https://bigprof.com/appgini/help/workin ... s/DataList
Olaf
Re: Custom Hook
Posted: 2020-11-13 15:41
by pbottcher
To add to this,
As you did not specify how you define
up to certain time ...
Code: Select all
if (YOUR_TIME_CHECK == true ) {
if (in_array($memberInfo['group'], array('GROUP_1_THAT_HAS_PERMISSIONS','GROUP_2_THAT_HAS_PERMISSIONS'))) {
$options->AllowDelete= 1;
$options->AllowInsert= 1;
$options->AllowUpdate= 1;
} else {
$options->AllowDelete= 0;
$options->AllowInsert= 0;
$options->AllowUpdate= 0;
}
}