Exemplo n.º 1
0
 /**
  * RegisterAddonPermission
  * This adds the permission details passed in to the static userPermissions array.
  * This array is then used by GetAddonPermissions to return the permissions it needs based on whether an addon is available/enabled.
  * Regardless of the addon or permissions you try to set, a super-administrator always has access to it - they cannot be blocked or locked out.
  * If an addon does not set any permissions, then only a super-administrator will be able to access it through the menu item it creates.
  * The permissions can be used in conjunction with the menu items to only appear for certain users who have a permission set.
  *
  * <code>
  * $permissions = array (
  * 	'addon_id' => array (
  *		'addon_description' => 'This is the short description for the addon. It comes from the description.xml file.',
  * 		'permission_1' => array (
  * 			'name' => 'This is the name of the permission. The name is a short description (eg "Create Options")',
  * 			'help' => 'This is the help tip description if it needs one. If one is not supplied, a help tip icon is not shown next to the permission'
  * 		),
  * 		'permission_2' => array (
  * 			'name' => 'This is another permission (eg "Edit Options"). It does not have a helptip'
  * 		),
  * 		'permission_3' => array (
  * 			'name' => 'This is a 3rd permission (eg "Delete Options"). It does have a helptip',
  * 			'help' => 'This is the helptip for the 3rd permission'
  * 		),
  * 	)
  * );
  * </code>
  *
  * The permissions are checked like:
  *
  * <code>
  * $access_ok = $user->HasAccess('addon_id', 'permission_1');
  * if (!$access_ok) {
  * 	echo "Permission denied";
  * } else {
  * 	echo "Permission granted";
  * }
  * </code>
  *
  * @param Array $permissions The new permissions to include for the addon.
  *
  * @uses userPermissions
  * @see GetEventListeners
  * @see User_API::GrantAccess
  * @see User_API::RevokeAccess
  * @see User_API::HasAccess
  * @see GetMenuItems
  * @see RegisterMenuItems
  */
 static function RegisterAddonPermission($permissions = array())
 {
     self::$userPermissions = array_merge(self::$userPermissions, $permissions);
 }