The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
Zotlabs\Lib\PermissionDescription Class Reference

Public Member Functions

 get_permission_description ()
 
 get_permission_icon ()
 
 get_permission_origin_description ()
 

Static Public Member Functions

static fromDescription ($description)
 
static fromStandalonePermission ($perm)
 
static fromGlobalPermission ($permname)
 

Private Member Functions

 __construct ($global_perm, $channel_perm, $description= '')
 

Private Attributes

 $global_perm
 
 $channel_perm
 
 $fallback_description
 

Detailed Description

Encapsulates information the ACL dialog requires to describe permission settings for an item with an empty ACL. i.e the caption, icon, and tooltip for the no-ACL option in the ACL dialog.

Constructor & Destructor Documentation

Zotlabs\Lib\PermissionDescription::__construct (   $global_perm,
  $channel_perm,
  $description = '' 
)
private

Constructor is private. Use static methods fromGlobalPermission(), fromStandalonePermission(), or fromDescription() to create instances.

Member Function Documentation

static Zotlabs\Lib\PermissionDescription::fromDescription (   $description)
static

If the interpretation of an empty ACL can't be summarised with a global default permission or a specific permission setting then use this method and describe what it means instead. Remember to localize the description first.

Parameters
string$description- the localized caption for the no-ACL option in the ACL dialog.
Returns
a new instance of PermissionDescription
static Zotlabs\Lib\PermissionDescription::fromGlobalPermission (   $permname)
static

This is the preferred way to create a PermissionDescription, as it provides the most details. Use this method if you know an empty ACL will result in one of the global default permissions being used, such as channel_r_stream (for which you would pass 'view_stream').

Parameters
string$permname- a key for the global perms array from get_perms() in permissions.php, e.g. 'view_stream', 'view_profile', etc.
Returns
a new instance of PermissionDescription
static Zotlabs\Lib\PermissionDescription::fromStandalonePermission (   $perm)
static

Use this method only if the interpretation of an empty ACL doesn't fall back to a global default permission. You should pass one of the constants from boot.php - PERMS_PUBLIC, PERMS_NETWORK etc.

Parameters
integer$perm- a single enumerated constant permission - PERMS_PUBLIC, PERMS_NETWORK etc.
Returns
a new instance of PermissionDescription
Zotlabs\Lib\PermissionDescription::get_permission_description ( )

Gets a localized description of the permission, or a generic message if the permission is unknown.

Returns
string description
Zotlabs\Lib\PermissionDescription::get_permission_icon ( )

Returns an icon css class name if an appropriate one is available, e.g. "fa-globe" for Public, otherwise returns empty string.

Returns
string icon css class name (often FontAwesome)
Zotlabs\Lib\PermissionDescription::get_permission_origin_description ( )

Returns a localized description of where the permission came from, if this is known. If it's not know, or if the permission is standalone and didn't come from a default permission setting, then empty string is returned.

Returns
string description or empty string

Member Data Documentation

Zotlabs\Lib\PermissionDescription::$channel_perm
private
Zotlabs\Lib\PermissionDescription::$fallback_description
private
Zotlabs\Lib\PermissionDescription::$global_perm
private

The documentation for this class was generated from the following file: