diff options
| -rw-r--r-- | LibertyBase.php | 15 | ||||
| -rw-r--r-- | LibertyContent.php | 10 |
2 files changed, 19 insertions, 6 deletions
diff --git a/LibertyBase.php b/LibertyBase.php index 0e43a2d..0bd04fe 100644 --- a/LibertyBase.php +++ b/LibertyBase.php @@ -3,7 +3,7 @@ * Base class for Management of Liberty Content * * @package liberty - * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyBase.php,v 1.7 2006/02/01 18:42:12 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyBase.php,v 1.8 2006/02/09 14:45:28 lsces Exp $ * @author spider <spider@steelsun.com> */ // +----------------------------------------------------------------------+ @@ -51,18 +51,25 @@ class LibertyBase extends BitBase { */ function getLibertyObject( $pContentId, $pContentGuid=NULL ) { $ret = NULL; - global $gLibertySystem; + global $gLibertySystem, $gBitUser, $gBitSystem; if( BitBase::verifyId( $pContentId ) ) { if( empty( $pContentGuid ) ) { - $pContentGuid = $gLibertySystem->mDb->getOne( "SELECT `content_type_guid` FROM `".BIT_DB_PREFIX."liberty_content` WHERE `content_id`=?", array( $pContentId ) ); + $ret = $gLibertySystem->mDb->getRow( "SELECT `content_type_guid`, `group_id` FROM `".BIT_DB_PREFIX."liberty_content` WHERE `content_id`=?", array( $pContentId ) ); + if ( !empty($gBitUser->mGroups[$ret['group_id']] ) ) { + $pContentGuid = $ret[content_type_guid]; + } else { + $gBitSystem->fatalError( 'You do not have permission to access this item' ); + $ret = NULL; + } } - if( !empty( $pContentGuid) && isset( $gLibertySystem->mContentTypes[$pContentGuid] ) ) { + if( !empty( $pContentGuid ) && isset( $gLibertySystem->mContentTypes[$pContentGuid] ) ) { $type = $gLibertySystem->mContentTypes[$pContentGuid]; require_once( constant( strtoupper( $type['handler_package'] ).'_PKG_PATH' ).$type['handler_file'] ); $ret = new $type['handler_class']( NULL, $pContentId ); $ret->load(); } + } return $ret; } diff --git a/LibertyContent.php b/LibertyContent.php index 9311cc8..2147cd9 100644 --- a/LibertyContent.php +++ b/LibertyContent.php @@ -3,7 +3,7 @@ * Management of Liberty content * * @package liberty -* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.52 2006/02/09 12:14:35 lsces Exp $ +* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.53 2006/02/09 14:45:28 lsces Exp $ * @author spider <spider@steelsun.com> */ @@ -90,11 +90,17 @@ class LibertyContent extends LibertyBase { */ function load($pContentId = NULL) { if( !empty( $this->mInfo['content_type_guid'] ) ) { - global $gLibertySystem, $gBitSystem; + global $gLibertySystem, $gBitSystem, $gBitUser; $this->loadPreferences(); $this->mInfo['content_type'] = $gLibertySystem->mContentTypes[$this->mInfo['content_type_guid']]; if( $gBitSystem->isPackageActive( 'gatekeeper' ) ) { // $this->mInfo['perm_level'] = $this->getUserPermissions(); + } else { + if ( empty($gBitUser->mGroups[$this->mInfo['group_id']] ) ) { + $this->mInfo = NULL; +// $this->mContentId = 0; + $pContentId = 0; + } } } |
