Changeset 15893
- Timestamp:
- 01/18/12 02:04:39 (4 months ago)
- Location:
- trunk/inc/classes
- Files:
-
- 3 edited
-
BxDolAcl.php (modified) (1 diff)
-
BxDolGrid.php (modified) (3 diffs)
-
BxDolPage.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/classes/BxDolAcl.php
r15872 r15893 103 103 104 104 return $GLOBALS['bxDolClasses'][__CLASS__]; 105 } 106 107 /** 108 * Check if member has one of the provided membership levels 109 * @param $iPermissions - integer value to check permissions for, every bit is matched with some membership id 110 * @param $iProfileId - profile if to check, if it isn't provided or is 0 then currently loggen in profile is used. 111 * @return true if member has privided membership levels, or false if member hasn't. 112 */ 113 public function isMemberLevelInSet($iPermissions, $iProfileId = 0) { 114 if (!$iPermissions) 115 return false; 116 if (!(int)$iProfileId) 117 $iProfileId = 1; // TODO: get current profile id 118 $aACL = $this->getMemberMembershipInfo($iProfileId); 119 return ($iPermissions & pow(2, $aACL['id'] - 1)); 105 120 } 106 121 -
trunk/inc/classes/BxDolGrid.php
r15880 r15893 67 67 * - auto: use 'like' or 'fulltext', depending on 'useLikeOperator' setting option. 68 68 * - sorting_fields: comma separated field names, which will be allowed for sorting. 69 * - visibile_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example: 70 * - user level id = 1 -> 2^(1-1) = 1 71 * - user level id = 2 -> 2^(2-1) = 2 72 * - user level id = 3 -> 2^(3-1) = 4 73 * - user level id = 4 -> 2^(4-1) = 8 69 74 * - override_class_name: user defined class name which is derived from BxTemplGrid. 70 75 * - override_class_file: the location of the user defined class, leave it empty if class is located in system folders. … … 281 286 282 287 $o = new $sClass($aObject); 288 289 if (!$o->_isVisibleGrid($aObject)) 290 return false; 283 291 284 292 return ($GLOBALS['bxDolClasses']['BxDolGrid!'.$sObject] = $o); … … 407 415 return str_replace(' ', '', ucwords(str_replace('_' , ' ', $s))); 408 416 } 417 418 protected function _isVisibleGrid ($a) { 419 bx_import('BxDolAcl'); 420 return BxDolAcl::getInstance()->isMemberLevelInSet($a['visibile_for_levels']); 421 } 409 422 } 410 423 -
trunk/inc/classes/BxDolPage.php
r15864 r15893 144 144 } 145 145 146 protected function _isVisible ($a) {147 if (!$a['visibile_for_levels'])148 return false;149 bx_import('BxTemplAcl');150 $oACL = BxTemplAcl::getInstance();151 $iProfileId = 1; // TODO: get current profile id152 $aACL = $oACL->getMemberMembershipInfo($iProfileId);153 return ($a['visibile_for_levels'] & pow(2, $aACL['id'] - 1));154 }155 156 146 protected function _isVisibleBlock ($a) { 157 return $this->_isVisible ($a); 147 bx_import('BxDolAcl'); 148 return BxDolAcl::getInstance()->isMemberLevelInSet($a['visibile_for_levels']); 158 149 } 159 150 160 151 protected function _isVisiblePage ($a) { 161 return $this->_isVisible ($a); 152 bx_import('BxDolAcl'); 153 return BxDolAcl::getInstance()->isMemberLevelInSet($a['visibile_for_levels']); 162 154 } 163 155
Note: See TracChangeset
for help on using the changeset viewer.