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
  • cApiSearchTracking
  • cApiSearchTrackingCollection
  • 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 frontend permission 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:  * Frontend permission collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiFrontendPermissionCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * instance of cApiFrontendPermission to access defined filters
 28:      *
 29:      * @var cApiFrontendPermission
 30:      */
 31:     protected $_frontendPermission;
 32: 
 33:     /**
 34:      * Constructor Function
 35:      */
 36:     public function __construct() {
 37:         global $cfg;
 38:         $this->_frontendPermission = new cApiFrontendPermission();
 39: 
 40:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
 41:         $this->_setItemClass('cApiFrontendPermission');
 42: 
 43:         // set the join partners so that joins can be used via link() method
 44:         $this->_setJoinPartner('cApiFrontendGroupCollection');
 45:         $this->_setJoinPartner('cApiLanguageCollection');
 46:     }
 47: 
 48:     /**
 49:      * Creates a new permission entry.
 50:      *
 51:      * @param int $group Specifies the frontend group
 52:      * @param string $plugin Specifies the plugin
 53:      * @param string $action Specifies the action
 54:      * @param string $item Specifies the item
 55:      * @return cApiFrontendPermission NULL
 56:      */
 57:     public function create($group, $plugin, $action, $item) {
 58:         global $lang;
 59: 
 60:         $perm = NULL;
 61:         if (!$this->checkPerm($group, $plugin, $action, $item)) {
 62:             $perm = parent::createNewItem();
 63:             $perm->set('idlang', $lang);
 64:             $perm->set('idfrontendgroup', $group);
 65:             $perm->set('plugin', $plugin);
 66:             $perm->set('action', $action);
 67:             $perm->set('item', $item);
 68: 
 69:             $perm->store();
 70:         }
 71: 
 72:         return $perm;
 73:     }
 74: 
 75:     /**
 76:      * Sets a permission entry, is a wrapper for create() function
 77:      *
 78:      * @param int $group Specifies the frontend group
 79:      * @param string $plugin Specifies the plugin
 80:      * @param string $action Specifies the action
 81:      * @param string $item Specifies the item
 82:      */
 83:     public function setPerm($group, $plugin, $action, $item) {
 84:         $this->create($group, $plugin, $action, $item);
 85:     }
 86: 
 87:     /**
 88:      * Cheks, if an entry exists.
 89:      *
 90:      * 1.) Checks for global permission
 91:      * 2.) Checks for specific item permission
 92:      *
 93:      * @param int $group Specifies the frontend group
 94:      * @param string $plugin Specifies the plugin
 95:      * @param string $action Specifies the action
 96:      * @param string $item Specifies the item
 97:      * @param bool $useLang Flag to use language (Not used!)
 98:      * @return bool
 99:      */
100:     public function checkPerm($group, $plugin, $action, $item, $useLang = false) {
101:         global $lang;
102: 
103:         // checklang = ($useLang !== false) ? $useLang : $lang;
104: 
105:         $group = (int) $group;
106:         $plugin = $this->_frontendPermission->_inFilter($plugin);
107:         $action = $this->_frontendPermission->_inFilter($action);
108:         $item = $this->_frontendPermission->_inFilter($item);
109: 
110:         // Check for global permisson
111:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '__GLOBAL__'");
112:         if ($this->next()) {
113:             return true;
114:         }
115: 
116:         // Check for item permisson
117:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
118:         return ($this->next()) ? true : false;
119:     }
120: 
121:     /**
122:      * Removes the permission.
123:      *
124:      * @param int $group Specifies the frontend group
125:      * @param string $plugin Specifies the plugin
126:      * @param string $action Specifies the action
127:      * @param string $item Specifies the item
128:      * @param bool $useLang Flag to use language (Not used!)
129:      * @return bool
130:      */
131:     public function removePerm($group, $plugin, $action, $item, $useLang = false) {
132:         global $lang;
133: 
134:         // checklang = ($useLang !== false) ? $useLang : $lang;
135: 
136:         $group = (int) $group;
137:         $plugin = $this->_frontendPermission->_inFilter($plugin);
138:         $action = $this->_frontendPermission->_inFilter($action);
139:         $item = $this->_frontendPermission->_inFilter($item);
140: 
141:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
142:         if (($myitem = $this->next()) !== false) {
143:             return $this->delete($myitem->get('idfrontendpermission'));
144:         }
145:         return false;
146:     }
147: }
148: 
149: /**
150:  * Frontend permission item
151:  *
152:  * @package Core
153:  * @subpackage GenericDB_Model
154:  */
155: class cApiFrontendPermission extends Item {
156: 
157:     /**
158:      * Constructor Function
159:      *
160:      * @param mixed $mId Specifies the ID of item to load
161:      */
162:     public function __construct($mId = false) {
163:         global $cfg;
164:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
165:         if ($mId !== false) {
166:             $this->loadByPrimaryKey($mId);
167:         }
168:     }
169: }
170: 
CMS CONTENIDO 4.9.3 API documentation generated by ApiGen 2.8.0