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!
Custom Hook
Re: Custom Hook
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):
also see https://bigprof.com/appgini/help/workin ... s/DataList
Olaf
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;
}
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: Custom Hook
To add to this,
As you did not specify how you define
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;
}
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.