Overview

Namespaces

  • Cron
  • None

Classes

  • _HtmlGrid_TableOut
  • _TransactionModel_RawSaveOperation
  • AccessControlComponent
  • AccessControlHelper
  • ActionListHelper
  • ActiveDirectoryUtils
  • AddCurrentPidToSchedulingShellCallLogs
  • AnonymousFunctionOperation
  • ArrayUtil
  • AssociationIntegrityBehavior
  • AtomicOperation
  • AuthenticationComponent
  • AuthenticationController
  • AuthenticationUser
  • AutocompleteDatasourceComponent
  • BaseModelComponent
  • Basics
  • CakeLayersHelper
  • CheckAndRunShell
  • ClassSearcher
  • CommandLineUtil
  • CommonValidationBehavior
  • ConfigurableShellCallsSchedulingTask
  • ConfigurationKey
  • ConfigurationKeys
  • ConfigurationKeysController
  • Context
  • ContextComponent
  • ContextHelper
  • Contexts
  • ControllerInspector
  • ControllerMenuHelper
  • CreateJournalingTables
  • CreateTableConfigurationKeys
  • CreateTableSchedulingConfigurableShellCalls
  • CreateTableSchedulingShellCallLogs
  • CreateTableSettedConfigurationKeys
  • CreateTableUserResetPasswordRequests
  • CreateTableUsers
  • CronSchedulingInstaller
  • CronValidationBehavior
  • CssBox
  • CssController
  • CssProperties
  • CssShell
  • CsvUtil
  • CustomDataModel
  • DatasourceDumperManager
  • DateTimeInput
  • DependencyShell
  • DetailHelper
  • DumperShell
  • ExtendedFieldsAccessControl
  • ExtendedFieldSet
  • ExtendedFieldSetHelper
  • ExtendedFieldsParser
  • ExtendedFormHelper
  • ExtendedHasManyAppModel
  • ExtendedOperationsBehavior
  • FieldDefinition
  • FieldRowDefinition
  • FieldSetDefinition
  • FieldSetLayoutHelper
  • FileOperations
  • FileOperations_Rename
  • FileOperations_SymLink
  • FileOperations_Touch
  • FileOperations_Unlink
  • FileSystem
  • FixConfigurationKeysPrimaryKey
  • FixSettedConfigurationKeysPrimaryKey
  • HasManyUtilsBehavior
  • HtmlDocument
  • HtmlGrid
  • HtmlGrid_Cell
  • HttpClient
  • HttpResponse
  • ImapClient
  • ImapMailBox
  • ImapParserShell
  • IncludePath
  • InputMasked
  • InputSearchable
  • InputsOnSubmit
  • InstallShell
  • JenkinsBuildShell
  • Journal
  • JournalDetail
  • JournalizedBehavior
  • JsonResponseComponent
  • LayoutsHelper
  • Ldap
  • LdapUtils
  • ListFieldSet
  • ListFieldSetHelper
  • ListsHelper
  • MailParser
  • Make
  • MenuHelper
  • MigrationAllPluginsShell
  • ModelOperations
  • ModelOperations_Delete
  • ModelOperations_Save
  • ModelTraverser
  • MysqlDumper
  • OpenLdapUtils
  • PaginatorUtilComponent
  • PaginatorUtilComponentFilter
  • PaginatorUtilHelper
  • Plugin
  • PluginManager
  • Reflections
  • RenameEnabledToActiveFromUsersTable
  • RunShellCallShell
  • ScaffoldUtilComponent
  • ScaffoldUtilHelper
  • Scheduling
  • SchedulingConfigurableShellCall
  • SchedulingConfigurableShellCallsController
  • SchedulingShellCallLog
  • SchedulingShellCallLogsController
  • SettedConfigurationKey
  • StuffreposPluginsRename
  • TimeZoneBehavior
  • TransactionModel
  • TransactionOperation
  • Translator
  • TranslatorShell
  • User
  • UserAuthenticationComponent
  • UserChangePassword
  • UserResetPassword
  • UserResetPasswordRequest
  • UserResetPasswordRequestSubmission
  • UsersController
  • ViewUtilHelper

Interfaces

  • AccessControlFilter
  • CommitableOperation
  • DatasourceDumper
  • MakeListener
  • SchedulingInstaller
  • TasksObject
  • UndoableOperation

Exceptions

  • LdapObjectNotWritableException
  • ModelTraverserException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: App::uses('AccessControlComponent', 'AccessControl.Controller/Component');
 4: App::uses('Helper', 'View');
 5: 
 6: class AccessControlHelper extends Helper {
 7: 
 8:     public $helpers = array(
 9:         'Html',
10:         'Form',
11:     );
12: 
13:     public function __call($method, $params) {
14:         if (preg_match('/^hasAccessBy(.+)$/', $method, $matches)) {
15:             if (count($params) < 1) {
16:                 trigger_error(__d('access_control','Missing argument 1 for %1$s::%2$s', get_class($this), $method), E_USER_ERROR);
17:             }
18: 
19:             return AccessControlComponent::sessionUserHasAccess(
20:                     $params[0], Inflector::variable($matches[1])
21:             );
22:         }
23: 
24:         return parent::__call($method, $params);
25:     }
26: 
27:     public function restrictedOutput($url, $contentIfTrue, $contentIfFalse = '', $return = true) {
28:         $out = $this->hasAccessByUrl($url) ? $contentIfTrue : $contentIfFalse;
29:         return $this->Html->output($out, $return);
30:     }
31: 
32:     public function link($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true, $showTextIfAccessDenied = false) {
33:         return $this->restrictedOutput(
34:                     $url, 
35:                 !empty($htmlAttributes['method']) && $htmlAttributes['method'] == 'post'
36:                 ? $this->Form->postlink($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle)
37:                 : $this->Html->link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle), ($showTextIfAccessDenied ? $title : '')
38:         );
39:     }
40: 
41:     public function linkOrText($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true, $showTextIfAccessDenied = false) {
42:         return $this->link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle, true);
43:     }
44: 
45:     public function image($title, $image, $url, $confirmationMessage = null) {
46:         return $this->restrictedOutput(
47:                         $url, $this->Html->image($image, array("alt" => $title, "title" => $title, 'url' => $url, "onclick" => (!empty($confirmationMessage) ? "return confirm('$confirmationMessage')" : "")))
48:         );
49:     }
50: 
51: }
52: 
53: ?>
54: 
API documentation generated by ApiGen 2.8.0