UNA
BxDolAcl Class Reference
Inheritance diagram for BxDolAcl:
BxDolFactory iBxDolSingleton BxBaseAcl BxTemplAcl

Public Member Functions

 __clone ()
 
 getContentByLevelAsCondition ($sContentField, $mixedLevelId)
 
 getContentByLevelAsSQLPart ($sContentTable, $sContentField, $mixedLevelId)
 
 isMemberLevelInSet ($mixedPermissions, $iProfileId=false)
 
 getMemberLevelBit ($iProfileId=0)
 
 checkAction ($iProfileId, $iActionId, $bPerformAction=false)
 
 getActionNumberLeft ($iProfileId, $iActionId)
 
 getMemberships ($bPurchasableOnly=false, $bActiveOnly=false, $isTranslate=true, $bFilterOutSystemAutomaticLevels=false)
 
 getMembershipInfo ($iLevelId)
 
 getMemberMembershipInfo ($iProfileId, $iTime=0, $bClearCache=0)
 
 setMembership ($iProfileId, $iLevelId, $mixedPeriod=0, $bStartsNow=false, $sTransactionId='')
 
 getMembershipActionId ($sAction, $sModule)
 
 maintenance ()
 

Static Public Member Functions

static getInstance ()
 

Member Function Documentation

◆ __clone()

BxDolAcl::__clone ( )

Prevent cloning the instance

◆ checkAction()

BxDolAcl::checkAction (   $iProfileId,
  $iActionId,
  $bPerformAction = false 
)

Checks if a given action is allowed for a given profile and updates action information if the action is performed.

Parameters
int$iProfileIdID of a profile that is going to perform an action
int$iActionIdID of the action itself
boolean$bPerformActionif true, then action information is updated, i.e. action is 'performed'
Returns
array( CHECK_ACTION_RESULT => CHECK_ACTION_RESULT_ constant, CHECK_ACTION_MESSAGE => CHECK_ACTION_MESSAGE_ constant, CHECK_ACTION_PARAMETER => additional action parameter (string) )

NOTES:

$aResult[CHECK_ACTION_MESSAGE] contains a message with detailed information about the result, already processed by the language file

if $aResult[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED then this node contains an empty string

The error messages themselves are stored in the language file. Additional variables are passed to the languages.inc.php function _t_ext() as an array and can be used there in the form of {0}, {1}, {2} ...

Additional variables passed to the lang. file on errors (can be used in error messages):

For all errors:

    $arg0[CHECK_ACTION_LANG_FILE_ACTION]    = name of the action
    $arg0[CHECK_ACTION_LANG_FILE_MEMBERSHIP]= name of the current membership

CHECK_ACTION_RESULT_LIMIT_REACHED:

    $arg0[CHECK_ACTION_LANG_FILE_LIMIT]     = limit on number of actions allowed for the profile
    $arg0[CHECK_ACTION_LANG_FILE_PERIOD]    = period that the limit is set for (in hours, 0 if unlimited)
    $arg0[CHECK_ACTION_LANG_FILE_PERIOD_RESTART_AT] = time when new period begins, so counter will be reset

CHECK_ACTION_RESULT_NOT_ALLOWED_BEFORE:

    $arg0[CHECK_ACTION_LANG_FILE_BEFORE]    = date/time since when the action is allowed

CHECK_ACTION_RESULT_NOT_ALLOWED_AFTER:

    $arg0[CHECK_ACTION_LANG_FILE_AFTER]     = date/time since when the action is not allowed

$aResult[CHECK_ACTION_PARAMETER] contains an additional parameter that can be considered when performing the action (like the number of profiles to show in search result)

Action is not allowed for the current membership

Check fixed period limitations if present (also for non-members)

if non-member, allow action without performing further checks

Check other limitations (for members only)

< Number of allowed actions. Unlimited if not specified or 0

< Period for AllowedCount in hours. If not specified, AllowedCount is treated as total number of actions permitted.

Member is requesting/performing this action for the first time, and there is no corresponding record in sys_acl_actions_track table.

Action has been requested/performed at least once at this point and there is a corresponding record in sys_acl_actions_track table

Action record in sys_acl_actions_track table is out of date.

< Action record is up to date

Action limit reached for now

◆ getActionNumberLeft()

BxDolAcl::getActionNumberLeft (   $iProfileId,
  $iActionId 
)

Get the number of allowed action

Parameters
int$iProfileIdID of a profile that is going to perform an action
int$iActionIdID of the action itself
boolean$bPerformActionif true, then action information is updated, i.e. action is 'performed'
Returns
int if the action is countable, or true if it's not countable

< Number of allowed actions. Unlimited if not specified or 0

◆ getContentByLevelAsCondition()

BxDolAcl::getContentByLevelAsCondition (   $sContentField,
  $mixedLevelId 
)

Get necessary condition array to use membership level in search classes

Parameters
$sContentFieldcontent table field name
$mixedLevelIdlevel ID or array of level IDs
Returns
array of conditions is returned

◆ getContentByLevelAsSQLPart()

BxDolAcl::getContentByLevelAsSQLPart (   $sContentTable,
  $sContentField,
  $mixedLevelId 
)

Get necessary parts of SQL query to use membership levels in other queries

Parameters
$sContentTablecontent table name
$sContentFieldcontent table field name
$mixedLevelIdlevel ID or array of level IDs
Returns
array of SQL string parts, for now 'where' part only is returned

◆ getInstance()

static BxDolAcl::getInstance ( )
static

Get singleton instance of the class

Implements iBxDolSingleton.

◆ getMemberLevelBit()

BxDolAcl::getMemberLevelBit (   $iProfileId = 0)

Get user's membership level bit for bitwise operarions

◆ getMemberMembershipInfo()

BxDolAcl::getMemberMembershipInfo (   $iProfileId,
  $iTime = 0,
  $bClearCache = 0 
)

Retrieves information about membership for a given profile at a given moment.

If there are no memberships purchased/assigned to the given profile or all of them have expired at the given point, the profile is assumed to be a standard profile, and the function returns information about the Standard membership. This will also happen if a profile wasnt actually registered in the database at that point - the function will still return info about Standard membership, not the Non-member one.

If there is no profile with the given $iProfileId, the function returns information about the Non-member or Authenticated predefined membership.

The Standard, Authenticated and Non-member memberships have their DateStarts and DateExpires attributes set to NULL.

Parameters
int$iProfileIdID of a profile to get info about
int$timespecifies the time to use when determining membership; if not specified, the function takes the current time
Returns
array( 'id' => membership id, 'name' => membership name, 'date_starts' => (UNIX timestamp) date/time purchased, 'date_expires' => (UNIX timestamp) date/time expires )

◆ getMembershipActionId()

BxDolAcl::getMembershipActionId (   $sAction,
  $sModule 
)

get action id by module and name

Parameters
$sActionaction name
$sModulemodule name
$aActionsarray of actions from sys_acl_actions table, with default array keys (starting from 0) and text values

◆ getMembershipInfo()

BxDolAcl::getMembershipInfo (   $iLevelId)

Get info about a given membership

Parameters
int$iLevelIdmembership to get info about
Returns
array( 'id' => ID, 'name' => name, 'icon' => icon, 'description' => description, 'active' => active, 'purchasable' => purchasable, 'removable' => removable 'quota_size' => quota size, 'quota_number' => quota number, 'quota_max_file_size' => quota max file size )

◆ getMemberships()

BxDolAcl::getMemberships (   $bPurchasableOnly = false,
  $bActiveOnly = false,
  $isTranslate = true,
  $bFilterOutSystemAutomaticLevels = false 
)

Get the list of existing memberships

Parameters
bool$bPurchasableOnlyif true, fetches only purchasable memberships; 'purchasable' here means that:
  • MemLevels.Purchasable = 'yes'
  • MemLevels.Active = 'yes'
  • there is at least one pricing option for the membership
Returns
array( membershipID_1 => membershipName_1, membershipID_2 => membershipName_2, ...) if no such memberships, then just array()

◆ isMemberLevelInSet()

BxDolAcl::isMemberLevelInSet (   $mixedPermissions,
  $iProfileId = false 
)

Check if member has one of the provided membership levels

Parameters
$mixedPermissions- integer value (every bit is matched with some membership ID) or an array of membership IDs to check permissions for
$iProfileId- profile to check, if it isn't provided or is false then currently logged in profile is used.
Returns
true if member has privided membership levels, or false if member hasn't.

◆ maintenance()

BxDolAcl::maintenance ( )

clear expired membership levels

◆ setMembership()

BxDolAcl::setMembership (   $iProfileId,
  $iLevelId,
  $mixedPeriod = 0,
  $bStartsNow = false,
  $sTransactionId = '' 
)

Set a membership for a profile

Parameters
int$iProfileIdprofile that is going to get the membership
int$iLevelIdmembership that is going to be assigned to the profile if $iLevelId == MEMBERSHIP_ID_STANDARD then $days and $bStartsNow parameters are not used, so Standard membership is always set immediately and forever
mixed$mixedPeriodnumber of Days to set membership for or an array with 'period'-'period unit' pair. If number or 'period' in pair equal 0, then the membership is set forever
boolean$bStartsNowif true, the membership will start immediately if false, the membership will start after the current membership expires
Returns
boolean true in case of success, false in case of failure

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