Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to set Permission for own Applications
Hi ...
today i try a deeper look into the Permissionmodel of Garden and i´m not sure if it´s possible to set Permissions for my own Application, because there are "hardcoded" columnnames of the permission table. Is it possible to add a permission
e.g.:
MyApplication.myController.Add
MyApplication.myController.Edit
MyApplication.myController.Delete
...
My thar is a good way to to this ... than let my now;)
LG
René
today i try a deeper look into the Permissionmodel of Garden and i´m not sure if it´s possible to set Permissions for my own Application, because there are "hardcoded" columnnames of the permission table. Is it possible to add a permission
e.g.:
MyApplication.myController.Add
MyApplication.myController.Edit
MyApplication.myController.Delete
...
My thar is a good way to to this ... than let my now;)
LG
René
0
Comments
$PermissionModel = Gdn::PermissionModel();
$PermissionModel->Database = $Database;
$PermissionModel->SQL = $SQL;
$PermissionModel->Define(array(
'CichlidWiki.Settings.Manage',
'CichlidWiki.Genus.Add',
'CichlidWiki.Genus.Edit',
'CichlidWiki.Genus.Delete'
));
And it run!!
realy realy cool permissionmodel! You have to wirte a Documentation
I'm also confused--do I have to add the permission to RegisterPermissions in about.php for my app? I haven't tried that yet, but if so, why doesn't Vanilla?
Anyway, the above code gives the following error:
Fatal Error in Gdn_DatabaseDebug.Query();
Unknown column 'DigitalMedia.Lab.Time' in 'field list'
update GDN_Permission Permission set
`DigitalMedia.Lab.Time` = :DigitalMediaLabTime
where RoleID = :RoleID and JunctionTable is null and JunctionColumn is null
where the key backtrace lines are:
[/home/simplerca/dm.lsta.me/applications/garden/models/class.permissionmodel.php:43] Gdn_SQLDriver->Replace();
[/home/simplerca/dm.lsta.me/applications/digitalmedia/settings/structure.php:27] Gdn_PermissionModel->Define();
Line 43 of PermissionModel says: $this->SQL->Replace('Permission', $this->_Backtick($DefaultPermissions), array('RoleID' => 0, 'JunctionTable' => $JunctionTable, 'JunctionColumn' => $JunctionColumn));
This doesn't change how PermissionModel was failing me (above), but at least I have an easy option that works. For each permission in the array, the Roles edit screen will create an HTML table based on the dot-separated hierarchy: My only question now, is can we use spaces? Or are underscores converted to spaces? I guess I'll have to try it and find out...
I would suggest that underscores be converted to spaces when presenting the application name or permission name, etc. Alternatively, if these app/column names are passed through translation, I could imagine the conversion being performed there instead.