UNA
BxDolPrivacy Class Reference
Inheritance diagram for BxDolPrivacy:
BxDolFactory iBxDolFactoryObject BxBasePrivacy BxTemplPrivacy BxBaseModFilesPrivacy BxBaseModNotificationsPrivacy BxBaseModProfilePrivacy BxBaseModProfilePrivacyContact BxBaseModProfilePrivacyPost BxMarketPrivacy BxFilesPrivacy BxPhotosPrivacy BxNtfsPrivacy BxTimelinePrivacy BxBaseModGroupsPrivacy BxPersonsPrivacy BxOrgsPrivacyContact BxPersonsPrivacyContact BxBaseModGroupsPrivacyPost BxPersonsPrivacyPost

Public Member Functions

 getContentByGroupAsCondition ($mixedGroupId)
 
 getContentPublicAsCondition ($iProfileIdOwner=0, $aCustomGroups=array())
 
 getContentByGroupAsSQLPart ($mixedGroupId)
 
 getContentPublicAsSQLPart ($iProfileIdOwner=0, $aCustomGroups=array())
 
 getContentPublicAndInContextAsSQLPart ($iProfileIdOwner=0, $aCustomGroups=[], $aCustomContexts=[])
 
 check ($iObjectId, $iViewerId=0)
 

Static Public Member Functions

static getObjectInstance ($sObject)
 
static getGroupChooser ($sObject, $iOwnerId=0, $aParams=array())
 
static getFieldName ($sObject, $sAction='')
 

Protected Member Functions

 __construct ($aObject)
 
 isDynamicGroupMember ($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
 
 getGroups ($iOwnerId=0, $aParams=[])
 
 isSelectGroupCustomUsers ($aParams)
 
 isSelectGroupCustomMemberships ($aParams)
 
 _check ($iObjectId, $iViewerId, $aObject)
 

Detailed Description

Privacy settings for any content.

Integration of the content with privacy engine allows site member to organize the access to his content.

In addition to regular privacy groups (Public, Friends), spaces are supported. When some space (usually some another profile) is specified as privacy, then another profile visibility is used to check the privacy.

Related classes: BxDolPrivacyQuery - database queries.

Example of usage:

  1. Register your privacy actions in sys_privacy_actions database table.
  2. Add one privacy field(with INT type) in the table with your items for each action. For example, for action 'comment', the field name should be 'allow_comment_to'.
  3. Add group choosers for necessary actions in the form, which is used to add new items.
    $oPrivacy = new BxDolPrivacy();
    $oPrivacy->getGroupChooser($iItemOwnerId, $sModuleUri, $sModuleAction);
  4. Check privacy when any user tries to view an item.

    $oPrivacy = new BxDolPrivacy($sTable, $sFieldId, $sFieldOwnerId);
    if($oPrivacy->check($sAction, $iObjectId, $iViewerId)) {
    //show necessary content
    }
    See also
    an example of integration in BoonEx modules, for example: Posts

    Memberships/ACL: Doesn't depend on user's membership.

Alerts: no alerts available

Constructor & Destructor Documentation

◆ __construct()

BxDolPrivacy::__construct (   $aObject)
protected

Constructor

Parameters
$aObjectarray of grid options

Member Function Documentation

◆ _check()

BxDolPrivacy::_check (   $iObjectId,
  $iViewerId,
  $aObject 
)
protected

Check whether the viewer can make requested action.

Parameters
integer$iObjectIdobject ID the action to be performed with.
integer$iViewerIdviewer ID.
Returns
boolean result of operation.

◆ check()

BxDolPrivacy::check (   $iObjectId,
  $iViewerId = 0 
)

Check whether the viewer can make requested action.

Parameters
integer$iObjectIdobject ID the action to be performed with.
integer$iViewerIdviewer ID.
Returns
boolean result of operation.

◆ getContentByGroupAsCondition()

BxDolPrivacy::getContentByGroupAsCondition (   $mixedGroupId)

Get necessary condition array to use privacy in search classes

Parameters
$mixedGroupIdgroup ID or array of group IDs
Returns
array of conditions, for now with 'restriction' part only is returned

◆ getContentByGroupAsSQLPart()

BxDolPrivacy::getContentByGroupAsSQLPart (   $mixedGroupId)

Get necessary parts of SQL query to use privacy in other queries

Parameters
$mixedGroupIdgroup ID or array of group IDs
Returns
array of SQL string parts, for now 'where' part only is returned

◆ getContentPublicAndInContextAsSQLPart()

BxDolPrivacy::getContentPublicAndInContextAsSQLPart (   $iProfileIdOwner = 0,
  $aCustomGroups = [],
  $aCustomContexts = [] 
)

Get necessary parts of SQL query to use privacy in other queries

Parameters
$iProfileIdOwnerowner profile ID
Returns
array of SQL string parts, for now 'where' part only is returned

◆ getContentPublicAsCondition()

BxDolPrivacy::getContentPublicAsCondition (   $iProfileIdOwner = 0,
  $aCustomGroups = array() 
)

Get necessary condition array to use privacy in search classes

Parameters
$iProfileIdOwnerowner profile ID
Returns
array of conditions, for now with 'restriction' part only is returned

◆ getContentPublicAsSQLPart()

BxDolPrivacy::getContentPublicAsSQLPart (   $iProfileIdOwner = 0,
  $aCustomGroups = array() 
)

Get necessary parts of SQL query to use privacy in other queries

Parameters
$iProfileIdOwnerowner profile ID
Returns
array of SQL string parts, for now 'where' part only is returned

◆ getFieldName()

static BxDolPrivacy::getFieldName (   $sObject,
  $sAction = '' 
)
static

Get database field name for action.

Parameters
string$sObjectprivacy object name.
string$sActionaction name.
Returns
string with field name.

◆ getGroupChooser()

static BxDolPrivacy::getGroupChooser (   $sObject,
  $iOwnerId = 0,
  $aParams = array() 
)
static

Get Select element with available groups.

Parameters
string$sObjectprivacy object name.
integer$iOwnerIdobject's owner ID.
array$aParamsan array of custom selector's params (dynamic_groups - an array of arrays('key' => group_id, 'value' => group_title), title - the title to be used for generated field).
Returns
an array with Select element description.

◆ getGroups()

BxDolPrivacy::getGroups (   $iOwnerId = 0,
  $aParams = [] 
)
protected

get privacy groups for getGroupChooser

◆ getObjectInstance()

static BxDolPrivacy::getObjectInstance (   $sObject)
static

Get privacy object instance by object name

Parameters
$sObjectobject name
Returns
object instance or false on error

Implements iBxDolFactoryObject.

◆ isDynamicGroupMember()

BxDolPrivacy::isDynamicGroupMember (   $mixedGroupId,
  $iObjectOwnerId,
  $iViewerId,
  $iObjectId 
)
protected

Check whethere viewer is a member of dynamic group.

Parameters
mixed$mixedGroupIddynamic group ID.
integer$iObjectOwnerIdobject owner ID.
integer$iViewerIdviewer ID.
Returns
boolean result of operation.

◆ isSelectGroupCustomMemberships()

BxDolPrivacy::isSelectGroupCustomMemberships (   $aParams)
protected

Check whethere a custom group (based on memberships list) is allowed in current circumstances. NOTE. Can be overwritten if it's needed.

Parameters
type$aParamsan array of parameters.
Returns
boolean result of operation.

◆ isSelectGroupCustomUsers()

BxDolPrivacy::isSelectGroupCustomUsers (   $aParams)
protected

Check whethere a custom group (based on users list) is allowed in current circumstances. NOTE. Can be overwritten if it's needed.

Parameters
type$aParamsan array of parameters.
Returns
boolean result of operation.

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