Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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
  • cApiArticleLanguageVersion
  • cApiArticleLanguageVersionCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • cApiContentVersion
  • cApiContentVersionCollection
  • 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
  • cApiMetaTagVersion
  • cApiMetaTagVersionCollection
  • 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
  • cApiUserPasswordRequest
  • cApiUserPasswordRequestCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the frontend permission collection and item class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GenericDB_Model
  8:  * @author Murat Purc <murat@purc.de>
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * Frontend permission collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiFrontendPermissionCollection extends ItemCollection {
 24: 
 25:     /**
 26:      * instance of cApiFrontendPermission to access defined filters
 27:      *
 28:      * @var cApiFrontendPermission
 29:      */
 30:     protected $_frontendPermission;
 31: 
 32:     /**
 33:      * Constructor Function
 34:      */
 35:     public function __construct() {
 36:         global $cfg;
 37:         $this->_frontendPermission = new cApiFrontendPermission();
 38: 
 39:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
 40:         $this->_setItemClass('cApiFrontendPermission');
 41: 
 42:         // set the join partners so that joins can be used via link() method
 43:         $this->_setJoinPartner('cApiFrontendGroupCollection');
 44:         $this->_setJoinPartner('cApiLanguageCollection');
 45:     }
 46: 
 47:     /**
 48:      * Creates a new permission entry.
 49:      *
 50:      * @param int $group
 51:      *         Specifies the frontend group
 52:      * @param string $plugin
 53:      *         Specifies the plugin
 54:      * @param string $action
 55:      *         Specifies the action
 56:      * @param string $item
 57:      *         Specifies the item
 58:      * @return cApiFrontendPermission|false
 59:      */
 60:     public function create($group, $plugin, $action, $item) {
 61:         global $lang;
 62: 
 63:         $perm = false;
 64:         if (!$this->checkPerm($group, $plugin, $action, $item)) {
 65:             $perm = $this->createNewItem();
 66:             $perm->set('idlang', $lang);
 67:             $perm->set('idfrontendgroup', $group);
 68:             $perm->set('plugin', $plugin);
 69:             $perm->set('action', $action);
 70:             $perm->set('item', $item);
 71: 
 72:             $perm->store();
 73: 
 74:             return $perm;
 75:         }
 76: 
 77:     }
 78: 
 79:     /**
 80:      * Sets a permission entry, is a wrapper for create() function
 81:      *
 82:      * @param int $group
 83:      *         Specifies the frontend group
 84:      * @param string $plugin
 85:      *         Specifies the plugin
 86:      * @param string $action
 87:      *         Specifies the action
 88:      * @param string $item
 89:      *         Specifies the item
 90:      */
 91:     public function setPerm($group, $plugin, $action, $item) {
 92:         $this->create($group, $plugin, $action, $item);
 93:     }
 94: 
 95:     /**
 96:      * Cheks, if an entry exists.
 97:      *
 98:      * 1.) Checks for global permission
 99:      * 2.) Checks for specific item permission
100:      *
101:      * @param int $group
102:      *         Specifies the frontend group
103:      * @param string $plugin
104:      *         Specifies the plugin
105:      * @param string $action
106:      *         Specifies the action
107:      * @param string $item
108:      *         Specifies the item
109:      * @param bool $useLang [optional]
110:      *         Flag to use language (Not used!)
111:      * @return bool
112:      */
113:     public function checkPerm($group, $plugin, $action, $item, $useLang = false) {
114:         global $lang;
115: 
116:         // checklang = ($useLang !== false) ? $useLang : $lang;
117: 
118:         $group = (int) $group;
119:         $plugin = $this->_frontendPermission->_inFilter($plugin);
120:         $action = $this->_frontendPermission->_inFilter($action);
121:         $item = $this->_frontendPermission->_inFilter($item);
122: 
123:         // Check for global permisson
124:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '__GLOBAL__'");
125:         if ($this->next()) {
126:             return true;
127:         }
128: 
129:         // Check for item permisson
130:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
131:         return ($this->next()) ? true : false;
132:     }
133: 
134:     /**
135:      * Removes the permission.
136:      *
137:      * @param int $group
138:      *         Specifies the frontend group
139:      * @param string $plugin
140:      *         Specifies the plugin
141:      * @param string $action
142:      *         Specifies the action
143:      * @param string $item
144:      *         Specifies the item
145:      * @param bool $useLang [optional]
146:      *         Flag to use language (Not used!)
147:      * @return bool
148:      */
149:     public function removePerm($group, $plugin, $action, $item, $useLang = false) {
150:         global $lang;
151: 
152:         // checklang = ($useLang !== false) ? $useLang : $lang;
153: 
154:         $group = (int) $group;
155:         $plugin = $this->_frontendPermission->_inFilter($plugin);
156:         $action = $this->_frontendPermission->_inFilter($action);
157:         $item = $this->_frontendPermission->_inFilter($item);
158: 
159:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
160:         if (($myitem = $this->next()) !== false) {
161:             return $this->delete($myitem->get('idfrontendpermission'));
162:         }
163:         return false;
164:     }
165: }
166: 
167: /**
168:  * Frontend permission item
169:  *
170:  * @package Core
171:  * @subpackage GenericDB_Model
172:  */
173: class cApiFrontendPermission extends Item {
174: 
175:     /**
176:      * Constructor Function
177:      *
178:      * @param mixed $mId [optional]
179:      *         Specifies the ID of item to load
180:      */
181:     public function __construct($mId = false) {
182:         global $cfg;
183:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
184:         if ($mId !== false) {
185:             $this->loadByPrimaryKey($mId);
186:         }
187:     }
188: }
189: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0