Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cApiAction
  • cApiActionCollection
  • cApiActionlog
  • cApiActionlogCollection
  • cApiArea
  • cApiAreaCollection
  • cApiArticle
  • cApiArticleCollection
  • cApiArticleLanguage
  • cApiArticleLanguageCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • cApiDbfs
  • cApiDbfsCollection
  • cApiFile
  • cApiFileCollection
  • cApiFileInformation
  • cApiFileInformationCollection
  • cApiFrameFile
  • cApiFrameFileCollection
  • cApiFrontendGroup
  • cApiFrontendGroupCollection
  • cApiFrontendGroupMember
  • cApiFrontendGroupMemberCollection
  • cApiFrontendPermission
  • cApiFrontendPermissionCollection
  • cApiFrontendUser
  • cApiFrontendUserCollection
  • cApiGroup
  • cApiGroupCollection
  • cApiGroupMember
  • cApiGroupMemberCollection
  • cApiGroupProperty
  • cApiGroupPropertyCollection
  • cApiInUse
  • cApiInUseCollection
  • cApiIso3166
  • cApiIso3166Collection
  • cApiIso6392
  • cApiIso6392Collection
  • cApiKeyword
  • cApiKeywordCollection
  • cApiLanguage
  • cApiLanguageCollection
  • cApiLayout
  • cApiLayoutCollection
  • cApiMailLog
  • cApiMailLogCollection
  • cApiMailLogSuccess
  • cApiMailLogSuccessCollection
  • cApiMetaTag
  • cApiMetaTagCollection
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the right collection and item class.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       GenericDB_Model
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Murat Purc <murat@purc.de>
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Right collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiRightCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * Constructor
 28:      */
 29:     public function __construct() {
 30:         global $cfg;
 31:         parent::__construct($cfg['tab']['rights'], 'idright');
 32:         $this->_setItemClass('cApiRight');
 33: 
 34:         // set the join partners so that joins can be used via link() method
 35:         $this->_setJoinPartner('cApiUserCollection');
 36:         $this->_setJoinPartner('cApiAreaCollection');
 37:         $this->_setJoinPartner('cApiActionCollection');
 38:         $this->_setJoinPartner('cApiCategoryCollection');
 39:         $this->_setJoinPartner('cApiClientCollection');
 40:         $this->_setJoinPartner('cApiLanguageCollection');
 41:     }
 42: 
 43:     /**
 44:      * Creates a right entry.
 45:      *
 46:      * @param string $userId
 47:      * @param int $idarea
 48:      * @param int $idaction
 49:      * @param int $idcat
 50:      * @param int $idclient
 51:      * @param int $idlang
 52:      * @param int $type
 53:      * @return cApiRight
 54:      */
 55:     public function create($userId, $idarea, $idaction, $idcat, $idclient, $idlang, $type) {
 56:         $oItem = parent::createNewItem();
 57: 
 58:         $oItem->set('user_id', $this->escape($userId));
 59:         $oItem->set('idarea', (int) $idarea);
 60:         $oItem->set('idaction', (int) $idaction);
 61:         $oItem->set('idcat', (int) $idcat);
 62:         $oItem->set('idclient', (int) $idclient);
 63:         $oItem->set('idlang', (int) $idlang);
 64:         $oItem->set('type', (int) $type);
 65: 
 66:         $oItem->store();
 67: 
 68:         return $oItem;
 69:     }
 70: 
 71:     /**
 72:      * Checks if a specific user has frontend access to a protected category.
 73:      *
 74:      * @param int $idcat
 75:      * @param string $userId
 76:      * @return bool
 77:      */
 78:     public function hasFrontendAccessByCatIdAndUserId($idcat, $userId) {
 79:         global $cfg;
 80: 
 81:         $sql = "SELECT :pk FROM `:rights` AS A, `:actions` AS B, `:area` AS C
 82:                 WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = ':userid'
 83:                     AND A.idcat = :idcat AND A.idarea = C.idarea AND B.idaction = A.idaction
 84:                 LIMIT 1";
 85: 
 86:         $params = array(
 87:             'pk' => $this->primaryKey,
 88:             'rights' => $this->table,
 89:             'actions' => $cfg['tab']['actions'],
 90:             'area' => $cfg['tab']['area'],
 91:             'userid' => $userId,
 92:             'idcat' => (int) $idcat
 93:         );
 94: 
 95:         $sql = $this->db->prepare($sql, $params);
 96:         $this->db->query($sql);
 97:         return ($this->db->nextRecord());
 98:     }
 99: 
100:     /**
101:      * Deletes right entries by user id.
102:      *
103:      * @todo Implement functions to delete rights by area, action, cat, client,
104:      *       language.
105:      * @param string $userId
106:      * @return bool
107:      */
108:     public function deleteByUserId($userId) {
109:         $result = $this->deleteBy('user_id', $userId);
110:         return ($result > 0) ? true : false;
111:     }
112: 
113: }
114: 
115: /**
116:  * Right item
117:  *
118:  * @package Core
119:  * @subpackage GenericDB_Model
120:  */
121: class cApiRight extends Item {
122: 
123:     /**
124:      * Constructor function
125:      *
126:      * @param mixed $mId Specifies the ID of item to load
127:      */
128:     public function __construct($mId = false) {
129:         global $cfg;
130:         parent::__construct($cfg['tab']['rights'], 'idright');
131:         $this->setFilters(array(), array());
132:         if ($mId !== false) {
133:             $this->loadByPrimaryKey($mId);
134:         }
135:     }
136: 
137: }
138: 
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0