History: Code Howto: Create a new permission
Source of version: 2 (current)
Copy to clipboard
^ Starting in ((Tiki8)), look at the function get_raw_permissions in lib/userslib.php ^
The permission list in Tiki is stored in the database. To create a new permission requires the same steps as a ((Database Schema Upgrade)).
Essentially, it requires to insert a new row in the ''users_permissions'' table. It must be done in both the __db/tiki.sql__ file and in a database patch file.
{CODE(caption=Sample permission creation)}
INSERT INTO `users_permissions` (`permName`, `permDesc`, `level`, `type`, `admin`, `feature_check`) VALUES('tiki_p_wiki_view_source', 'Can view source of wiki pages', 'basic', 'wiki', NULL, 'feature_source');
{CODE}
The relevant fields are:
;permName:The permission name beginning with the tiki_p_ prefix
;permDesc:A short description of what the permission does
;level:A group for the permission to be used by quick permission admin. Default available groups are basic, registered, editors and admin.
;type:The section to which the permission applies. Used by the admin field to grant permission to child permissions.
;admin:If the permission grants rights to all other permissions of the same type.
;feature_check:Features on which the permission depends. If the features are not enabled, the permission will not be listed in the user interfaces.