UNA
Loading...
Searching...
No Matches
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

 actionLoadGroupCustom ()
 
 actionSelectMembers ()
 
 actionSelectMemberships ()
 
 actionUsersList ()
 
 getGroupSettings ($iGroup)
 
 isGroupsCustom ()
 
 getGroupsBy ($aParams)
 
 getGroupCustom ($aParams)
 
 updateGroupCustom ($aParamsSet, $aParamsWhere)
 
 deleteGroupCustom ($aParamsWhere)
 
 associateGroupCustomWithContent ($iProfileId, $iContentId, $iGroupId)
 
 reassociateGroupCustomWithContent ($iProfileId, $iContentId, $iGroupId)
 
 deleteGroupCustomByContentId ($iContentId)
 
 deleteGroupCustomByProfileId ($iProfileId)
 
 addDynamicGroups ($aValues, $iOwnerId, $aParams)
 
 addSpaces ($aValues, $iOwnerId, $aParams)
 
 getContentByGroupAsCondition ($mixedGroupId)
 
 getContentPublicAsCondition ($iProfileIdOwner=0, $aCustomGroups=array())
 
 getContentByGroupAsSQLPart ($mixedGroupId)
 
 getContentPublicAsSQLPart ($iProfileIdOwner=0, $aCustomGroups=array())
 
 getContentPublicAndInContextAsSQLPart ($iProfileIdOwner=0, $aCustomGroups=[], $aCustomContexts=[])
 
 check ($iObjectId, $iViewerId=0)
 
 checkSpace ($aObject, $iViewerId)
 
 checkMeOnly ($iOwnerId, $iViewerId)
 
 checkPublic ($iOwnerId, $iViewerId)
 
 checkMembers ($iOwnerId, $iViewerId)
 
 checkFriends ($iOwnerId, $iViewerId)
 
 checkFriendsSelectedByObject ($aObject, $iViewerId)
 
 checkRelations ($iOwnerId, $iViewerId)
 
 checkRelationsSelectedByObject ($aObject, $iViewerId)
 
 checkMembershipsSelectedByObject ($aObject, $iViewerId)
 
 checkCustomByObject ($aObject, $iViewerId)
 
 setTableFieldAuthor ($sValue)
 
 isAllowedRelations ($iUserId)
 
 isAllowedMemberships ($iUserId)
 

Static Public Member Functions

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

Protected Member Functions

 __construct ($aObject)
 
 getObjectInfo ($sAction, $iObjectId)
 
 getPrivacyGroupsForContentPublic ($iProfileIdOwner=0, $aCustomGroups=array())
 
 getCheckMethod ($s)
 
 convertActionToField ($sAction)
 
 isDynamicGroupMember ($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
 
 getGroups ($iOwnerId=0, $aParams=[])
 
 isSelectGroupCustomUsers ($aParams)
 
 isSelectGroupCustomMemberships ($aParams)
 
 _check ($iObjectId, $iViewerId, $aObject)
 

Protected Attributes

 $_oDb
 
 $_sObject
 
 $_aObject
 
 $_aGroupsSettings
 
 $_aGroupsExclude
 
 $_sFormGroupCustom
 
 $_sFormDisplayGcMembers
 
 $_sFormDisplayGcMemberships
 

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);
    Definition BxDolPrivacy.php:66
  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.

Hooks:

'system', 'check_privacy' - check privacy for object

  • $unit_name - equals profile
  • $action - equals check_privacy
  • $object_id - not used
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:
    • object_id - [int] object id
    • viewer_id - [int] profile_id for viewer
    • object - [array] object privacy
    • object_privacy - [array] arry with object privacy
    • result - [bool] by ref, on success return true otherwise false, can be overridden in hook processing
      HOOKS
      'system', 'check_privacy' - check privacy for object

Reimplemented in BxBaseModGroupsPrivacyNotifications.

◆ 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

Hooks:

'system', 'privacy_condition' - hook on get necessary condition array to use privacy in search classes

  • $unit_name - equals profile
  • $action - equals privacy_condition
  • $object_id - not used
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:

◆ 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

Reimplemented in BxTimelinePrivacy.

◆ 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.

Reimplemented in BxBaseModGroupsPrivacy, and BxBaseModGroupsPrivacyPost.

◆ 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.

Reimplemented in BxBaseModGroupsPrivacy, BxBaseModGroupsPrivacyPost, and BxMarketPrivacy.

◆ 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.

Reimplemented in BxBaseModProfilePrivacy, BxBaseModProfilePrivacyContact, and BxBaseModProfilePrivacyPost.

◆ 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.

Reimplemented in BxBaseModProfilePrivacy, BxBaseModProfilePrivacyContact, and BxBaseModProfilePrivacyPost.


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