Good point, thank you!
When opening the project detail view the function
projects_dv() will be executed. If we had a function like
get_custom_permissions($table, $pk, $operation, $user_info) (see above), we were able to evaluate permissions for the (master-) record itself AND perhaps for all related data-subsets of children-tables.
If AppGini could give us an
&$options-variable in
TABLENAME_dv()-function, as I have suggested above, this could be an array like this (1st draft):
Code: Select all
$options = [
// permissions for master-record
"master" => [
"tableName" => "project",
"title" => "Projekt" . $data["name"],
"permissions" => [
"edit" => true, // all fields are editable
"update" => true, // enables "Save"
"copy" => false, // disables "Save as copy"
"delete" => false // disables "Delete"
]
],
// permissions for detail tables / children-records
"details" => [
"project_tasks" => [
"title" => "Aufgaben", // controls tab caption
"permissions" => [
"insert" => false, // disables insertion of project_tasks
"view" => "modal", // controls behaviour of button: { off | modal | _self | _blank }
"edit" => false, // when opening a sub-record, disable editing
"update" => false, // disable "save" of sub-record
"copy" => false, // disable "save as copy" for sub-record
"delete" => false // disable "delete" of sub-record
] // permissions
], // project_tasks
"project_milestones" => [
"title = "Meilensteile",
"permissions" => [
// ...
] // permissions
] // project_milestones
]
];
Having this kind of
$options-variable (or any other variable name like $datamodel or $viewmodel or just $model) we could control the behaviour and even control the view (eg change title or tab-captions) for master-record AND for all detail-tabs/-records.
Wouldn't that be great?
Maybe they can combine this idea with one feature which has been requested here a couple of times already: field-dependent permissions!
Imagine the
$options variable like this:
Code: Select all
$options = [
// permissions for master-record
"master" => [
// ...
"permissions" => [
...
], "columns" => [
"id" => [
"visible" => false
], "name" => [
"label" => "Project Name",
"edit" => $currentuser_is_projectowner, // evaluate before
"align" => "left" // { left | center | right }
]
// ...
]
],
// ...
]
There are some more ideas in my mind, but I think it would already be great and a big step forward if BigProf could implement that.
Best,
Jan