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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  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|false
 56:      */
 57:     public function create($group, $plugin, $action, $item) {
 58:         global $lang;
 59: 
 60:         $perm = false;
 61:         if (!$this->checkPerm($group, $plugin, $action, $item)) {
 62:             $perm = $this->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:             return $perm;
 72:         }
 73: 
 74:     }
 75: 
 76:     /**
 77:      * Sets a permission entry, is a wrapper for create() function
 78:      *
 79:      * @param int $group Specifies the frontend group
 80:      * @param string $plugin Specifies the plugin
 81:      * @param string $action Specifies the action
 82:      * @param string $item Specifies the item
 83:      */
 84:     public function setPerm($group, $plugin, $action, $item) {
 85:         $this->create($group, $plugin, $action, $item);
 86:     }
 87: 
 88:     /**
 89:      * Cheks, if an entry exists.
 90:      *
 91:      * 1.) Checks for global permission
 92:      * 2.) Checks for specific item permission
 93:      *
 94:      * @param int $group Specifies the frontend group
 95:      * @param string $plugin Specifies the plugin
 96:      * @param string $action Specifies the action
 97:      * @param string $item Specifies the item
 98:      * @param bool $useLang Flag to use language (Not used!)
 99:      * @return bool
100:      */
101:     public function checkPerm($group, $plugin, $action, $item, $useLang = false) {
102:         global $lang;
103: 
104:         // checklang = ($useLang !== false) ? $useLang : $lang;
105: 
106:         $group = (int) $group;
107:         $plugin = $this->_frontendPermission->_inFilter($plugin);
108:         $action = $this->_frontendPermission->_inFilter($action);
109:         $item = $this->_frontendPermission->_inFilter($item);
110: 
111:         // Check for global permisson
112:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '__GLOBAL__'");
113:         if ($this->next()) {
114:             return true;
115:         }
116: 
117:         // Check for item permisson
118:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
119:         return ($this->next()) ? true : false;
120:     }
121: 
122:     /**
123:      * Removes the permission.
124:      *
125:      * @param int $group Specifies the frontend group
126:      * @param string $plugin Specifies the plugin
127:      * @param string $action Specifies the action
128:      * @param string $item Specifies the item
129:      * @param bool $useLang Flag to use language (Not used!)
130:      * @return bool
131:      */
132:     public function removePerm($group, $plugin, $action, $item, $useLang = false) {
133:         global $lang;
134: 
135:         // checklang = ($useLang !== false) ? $useLang : $lang;
136: 
137:         $group = (int) $group;
138:         $plugin = $this->_frontendPermission->_inFilter($plugin);
139:         $action = $this->_frontendPermission->_inFilter($action);
140:         $item = $this->_frontendPermission->_inFilter($item);
141: 
142:         $this->select("idlang = " . $lang . " AND idfrontendgroup = " . $group . " AND plugin = '" . $plugin . "' AND action = '" . $action . "' AND item = '" . $item . "'");
143:         if (($myitem = $this->next()) !== false) {
144:             return $this->delete($myitem->get('idfrontendpermission'));
145:         }
146:         return false;
147:     }
148: }
149: 
150: /**
151:  * Frontend permission item
152:  *
153:  * @package Core
154:  * @subpackage GenericDB_Model
155:  */
156: class cApiFrontendPermission extends Item {
157: 
158:     /**
159:      * Constructor Function
160:      *
161:      * @param mixed $mId Specifies the ID of item to load
162:      */
163:     public function __construct($mId = false) {
164:         global $cfg;
165:         parent::__construct($cfg['tab']['frontendpermissions'], 'idfrontendpermission');
166:         if ($mId !== false) {
167:             $this->loadByPrimaryKey($mId);
168:         }
169:     }
170: }
171: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen