Phundament App Class Reference
  • Package
  • Class
  • Tree

Packages

  • bootstrap
    • widgets
      • input
  • Image
  • None
  • p3admin
  • p3extensions
    • behaviors
    • commands
    • components
    • helpers
    • widgets
  • p3media
    • actions
    • controllers
    • models
  • p3pages
    • models
  • p3widgets
    • components
    • models
  • PHP
  • system
    • db
      • ar
    • gii
    • web
      • auth
      • helpers
      • widgets
  • yiiext
    • widgets
      • fancybox
      • lipsum
  • zii
    • widgets
      • grid

Classes

  • ActivationController
  • AdminController
  • AssignmentController
  • AssignmentForm
  • AuthChildForm
  • AuthItemController
  • AuthItemForm
  • BaseP3Widget
  • BaseP3WidgetMeta
  • BaseP3WidgetTranslation
  • Bootstrap
  • CImageComponent
  • CKEditor
  • CodeProvider
  • DefaultController
  • EChosen
  • EDbMigration
  • EditableField
  • EditableSaver
  • EMigrateCommand
  • ESelect2
  • EUserFlash
  • FullCrudFieldProvider
  • GenerateForm
  • IdentificationColumnValidator
  • InstallController
  • JSONEditorView
  • JuiJSONEditorInput
  • LoginController
  • LogoutController
  • Metadata
  • P3CrudFieldProvider
  • P3MediaController
  • P3MediaMetaController
  • P3MediaSelect
  • P3PageController
  • P3PageMetaController
  • P3PageTranslationController
  • P3Widget
  • P3WidgetController
  • P3WidgetMetaController
  • P3WidgetTranslation
  • P3WidgetTranslationController
  • ProfileController
  • ProfileFieldController
  • RAuthItemBehavior
  • RAuthItemChildDataProvider
  • RAuthItemDataProvider
  • RAuthItemParentDataProvider
  • RAuthorizer
  • RController
  • RDbAuthManager
  • RecoveryController
  • RegistrationController
  • RegistrationForm
  • RGenerator
  • Rights
  • RightsFilter
  • RightsModule
  • RInstaller
  • RPermissionDataProvider
  • RUserBehavior
  • RWebUser
  • UActiveForm
  • UploadHandler
  • UserChangePassword
  • UserController
  • UserIdentity
  • UserLogin
  • UserModule
  • UserRecoveryForm
  • UWdropDownDep
  • UWfile
  • UWjuiAutoComplete
  • UWjuidate
  • UWrelBelongsTo
  • WebUserBehavior
 1 <?php
 2 /**
 3 * Rights web user class file.
 4 *
 5 * @author Christoffer Niska <cniska@live.com>
 6 * @copyright Copyright &copy; 2010 Christoffer Niska
 7 * @since 0.5
 8 */
 9 class RWebUser extends CWebUser
10 {
11     /**
12     * Actions to be taken after logging in.
13     * Overloads the parent method in order to mark superusers.
14     * @param boolean $fromCookie whether the login is based on cookie.
15     */
16     public function afterLogin($fromCookie)
17     {
18         parent::afterLogin($fromCookie);
19 
20         // Mark the user as a superuser if necessary.
21         if( Rights::getAuthorizer()->isSuperuser($this->getId())===true )
22             $this->isSuperuser = true;
23     }
24 
25     /**
26     * Performs access check for this user.
27     * Overloads the parent method in order to allow superusers access implicitly.
28     * @param string $operation the name of the operation that need access check.
29     * @param array $params name-value pairs that would be passed to business rules associated
30     * with the tasks and roles assigned to the user.
31     * @param boolean $allowCaching whether to allow caching the result of access checki.
32     * This parameter has been available since version 1.0.5. When this parameter
33     * is true (default), if the access check of an operation was performed before,
34     * its result will be directly returned when calling this method to check the same operation.
35     * If this parameter is false, this method will always call {@link CAuthManager::checkAccess}
36     * to obtain the up-to-date access result. Note that this caching is effective
37     * only within the same request.
38     * @return boolean whether the operations can be performed by this user.
39     */
40     public function checkAccess($operation, $params=array(), $allowCaching=true)
41     {
42         // Allow superusers access implicitly and do CWebUser::checkAccess for others.
43         return $this->isSuperuser===true ? true : parent::checkAccess($operation, $params, $allowCaching);
44     }
45 
46     /**
47     * @param boolean $value whether the user is a superuser.
48     */
49     public function setIsSuperuser($value)
50     {
51         $this->setState('Rights_isSuperuser', $value);
52     }
53 
54     /**
55     * @return boolean whether the user is a superuser.
56     */
57     public function getIsSuperuser()
58     {
59         return $this->getState('Rights_isSuperuser');
60     }
61     
62     /**
63      * @param array $value return url.
64      */
65     public function setRightsReturnUrl($value)
66     {
67         $this->setState('Rights_returnUrl', $value);
68     }
69     
70     /**
71      * Returns the URL that the user should be redirected to 
72      * after updating an authorization item.
73      * @param string $defaultUrl the default return URL in case it was not set previously. If this is null,
74      * the application entry URL will be considered as the default return URL.
75      * @return string the URL that the user should be redirected to 
76      * after updating an authorization item.
77      */
78     public function getRightsReturnUrl($defaultUrl=null)
79     {
80         if( ($returnUrl = $this->getState('Rights_returnUrl'))!==null )
81             $this->returnUrl = null;
82         
83         return $returnUrl!==null ? CHtml::normalizeUrl($returnUrl) : CHtml::normalizeUrl($defaultUrl);
84     }
85 }
86 
Phundament App Class Reference API documentation generated by ApiGen 2.8.0