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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • 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 to create an instance of this class.
 34:      *
 35:      * @throws cInvalidArgumentException
 36:      */
 37:     public function __construct() {
 38:         global $cfg;
 39:         $this->_frontendPermission = new cApiFrontendPermission();
 40: 
 41:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
 42:         $this->_setItemClass('cApiFrontendPermission');
 43: 
 44:         // set the join partners so that joins can be used via link() method
 45:         $this->_setJoinPartner('cApiFrontendGroupCollection');
 46:         $this->_setJoinPartner('cApiLanguageCollection');
 47:     }
 48: 
 49:     /**
 50:      * Creates a new permission entry.
 51:      *
 52:      * @param int    $group
 53:      *         Specifies the frontend group
 54:      * @param string $plugin
 55:      *         Specifies the plugin
 56:      * @param string $action
 57:      *         Specifies the action
 58:      * @param string $item
 59:      *         Specifies the item
 60:      *
 61:      * @return cApiFrontendPermission|false
 62:      * @throws cDbException
 63:      * @throws cException
 64:      * @throws cInvalidArgumentException
 65:      */
 66:     public function create($group, $plugin, $action, $item) {
 67:         global $lang;
 68: 
 69:         $perm = false;
 70:         if (!$this->checkPerm($group, $plugin, $action, $item)) {
 71:             $perm = $this->createNewItem();
 72:             $perm->set('idlang', $lang);
 73:             $perm->set('idfrontendgroup', $group);
 74:             $perm->set('plugin', $plugin);
 75:             $perm->set('action', $action);
 76:             $perm->set('item', $item);
 77: 
 78:             $perm->store();
 79:         }
 80: 
 81:         return $perm;
 82:     }
 83: 
 84:     /**
 85:      * Sets a permission entry, is a wrapper for create() function
 86:      *
 87:      * @param int    $group
 88:      *         Specifies the frontend group
 89:      * @param string $plugin
 90:      *         Specifies the plugin
 91:      * @param string $action
 92:      *         Specifies the action
 93:      * @param string $item
 94:      *         Specifies the item
 95:      *
 96:      * @throws cDbException
 97:      * @throws cException
 98:      * @throws cInvalidArgumentException
 99:      */
100:     public function setPerm($group, $plugin, $action, $item) {
101:         $this->create($group, $plugin, $action, $item);
102:     }
103: 
104:     /**
105:      * Cheks, if an entry exists.
106:      *
107:      * 1.) Checks for global permission
108:      * 2.) Checks for specific item permission
109:      *
110:      * @param int    $group
111:      *                        Specifies the frontend group
112:      * @param string $plugin
113:      *                        Specifies the plugin
114:      * @param string $action
115:      *                        Specifies the action
116:      * @param string $item
117:      *                        Specifies the item
118:      * @param bool   $useLang [optional]
119:      *                        Flag to use language (Not used!)
120:      * @return bool
121:      * @throws cDbException
122:      * @throws cException
123:      */
124:     public function checkPerm($group, $plugin, $action, $item, $useLang = false) {
125:         global $lang;
126: 
127:         // checklang = ($useLang !== false) ? $useLang : $lang;
128: 
129:         $group = (int) $group;
130:         $plugin = $this->_frontendPermission->_inFilter($plugin);
131:         $action = $this->_frontendPermission->_inFilter($action);
132:         $item = $this->_frontendPermission->_inFilter($item);
133: 
134:         // Check for global permisson
135:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '__GLOBAL__'");
136:         if ($this->next()) {
137:             return true;
138:         }
139: 
140:         // Check for item permisson
141:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
142:         return ($this->next()) ? true : false;
143:     }
144: 
145:     /**
146:      * Removes the permission.
147:      *
148:      * @param int    $group
149:      *                        Specifies the frontend group
150:      * @param string $plugin
151:      *                        Specifies the plugin
152:      * @param string $action
153:      *                        Specifies the action
154:      * @param string $item
155:      *                        Specifies the item
156:      * @param bool   $useLang [optional]
157:      *                        Flag to use language (Not used!)
158:      * @return bool
159:      *
160:      * @throws cDbException
161:      * @throws cException
162:      * @throws cInvalidArgumentException
163:      */
164:     public function removePerm($group, $plugin, $action, $item, $useLang = false) {
165:         global $lang;
166: 
167:         // checklang = ($useLang !== false) ? $useLang : $lang;
168: 
169:         $group = (int) $group;
170:         $plugin = $this->_frontendPermission->_inFilter($plugin);
171:         $action = $this->_frontendPermission->_inFilter($action);
172:         $item = $this->_frontendPermission->_inFilter($item);
173: 
174:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
175:         if (($myitem = $this->next()) !== false) {
176:             return $this->delete($myitem->get('idfrontendpermission'));
177:         }
178:         return false;
179:     }
180: }
181: 
182: /**
183:  * Frontend permission item
184:  *
185:  * @package Core
186:  * @subpackage GenericDB_Model
187:  */
188: class cApiFrontendPermission extends Item
189: {
190:     /**
191:      * Constructor to create an instance of this class.
192:      *
193:      * @param mixed $mId [optional]
194:      *                   Specifies the ID of item to load
195:      *
196:      * @throws cDbException
197:      * @throws cException
198:      * @throws cInvalidArgumentException
199:      */
200:     public function __construct($mId = false) {
201:         global $cfg;
202:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
203:         if ($mId !== false) {
204:             $this->loadByPrimaryKey($mId);
205:         }
206:     }
207: }
208: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0