Custom Permission To Add Record Issue With Add On Fly

I am using TablePermission_Loaded event as follows to grant permissions to select users that are not admin.

if($_SESSION[‘UserID’] == 501 && CurrentTable()->TableName == “help_app_tag”){
$this->setCanList(TRUE);
$this->setCanView(TRUE);
$this->setCanAdd(TRUE);
$this->setCanEdit(TRUE);
$this->setCanDelete(TRUE);
}


The table “help_app_tag” contains a field “tag” that is a lookup for a table “help_app”. When adding or editing “help_app” records admin can add a new “tag” on the fly.

Permission to ADD records to the table “help_app_tag” have been granted as shown above. The add on the fly is not showing up for those granted permission only for the admin.

Any suggestions on how to allow those “granted permission” to add records to the “help_app_tag” table via the add on the fly button when adding or editing the “help_app” table would be greatly appreciated.

knightro wrote:

The add on the fly is not showing up for those granted permission only for the admin.

Did you mean the Add Option button now showing?

The + button next to the lookup field

From the help file:

TablePermission_Loaded - This event is fired after the user permission for the table of the current page is loaded.

  1. In your code, ‘CurrentTable()->TableName == “help_app_tag”’ is not required,
  2. Your code set the permissions for the current table, i.e. “help_app_tag”, not “help_app”,
  3. To grant “Add” permissions to the “help_app” table, you may use TablePermission_Loaded for “help_app”.