Complex classes like Security often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Security, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 34 | class Security extends Controller implements TemplateGlobalProvider |
||
| 35 | { |
||
| 36 | |||
| 37 | private static $allowed_actions = array( |
||
|
|
|||
| 38 | 'index', |
||
| 39 | 'login', |
||
| 40 | 'logout', |
||
| 41 | 'basicauthlogin', |
||
| 42 | 'lostpassword', |
||
| 43 | 'passwordsent', |
||
| 44 | 'changepassword', |
||
| 45 | 'ping', |
||
| 46 | 'LoginForm', |
||
| 47 | 'ChangePasswordForm', |
||
| 48 | 'LostPasswordForm', |
||
| 49 | ); |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Default user name. Only used in dev-mode by {@link setDefaultAdmin()} |
||
| 53 | * |
||
| 54 | * @var string |
||
| 55 | * @see setDefaultAdmin() |
||
| 56 | */ |
||
| 57 | protected static $default_username; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Default password. Only used in dev-mode by {@link setDefaultAdmin()} |
||
| 61 | * |
||
| 62 | * @var string |
||
| 63 | * @see setDefaultAdmin() |
||
| 64 | */ |
||
| 65 | protected static $default_password; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * If set to TRUE to prevent sharing of the session across several sites |
||
| 69 | * in the domain. |
||
| 70 | * |
||
| 71 | * @config |
||
| 72 | * @var bool |
||
| 73 | */ |
||
| 74 | protected static $strict_path_checking = false; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * The password encryption algorithm to use by default. |
||
| 78 | * This is an arbitrary code registered through {@link PasswordEncryptor}. |
||
| 79 | * |
||
| 80 | * @config |
||
| 81 | * @var string |
||
| 82 | */ |
||
| 83 | private static $password_encryption_algorithm = 'blowfish'; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Showing "Remember me"-checkbox |
||
| 87 | * on loginform, and saving encrypted credentials to a cookie. |
||
| 88 | * |
||
| 89 | * @config |
||
| 90 | * @var bool |
||
| 91 | */ |
||
| 92 | private static $autologin_enabled = true; |
||
| 93 | |||
| 94 | /** |
||
| 95 | * Determine if login username may be remembered between login sessions |
||
| 96 | * If set to false this will disable autocomplete and prevent username persisting in the session |
||
| 97 | * |
||
| 98 | * @config |
||
| 99 | * @var bool |
||
| 100 | */ |
||
| 101 | private static $remember_username = true; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * Location of word list to use for generating passwords |
||
| 105 | * |
||
| 106 | * @config |
||
| 107 | * @var string |
||
| 108 | */ |
||
| 109 | private static $word_list = './wordlist.txt'; |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @config |
||
| 113 | * @var string |
||
| 114 | */ |
||
| 115 | private static $template = 'BlankPage'; |
||
| 116 | |||
| 117 | /** |
||
| 118 | * Template thats used to render the pages. |
||
| 119 | * |
||
| 120 | * @var string |
||
| 121 | * @config |
||
| 122 | */ |
||
| 123 | private static $template_main = 'Page'; |
||
| 124 | |||
| 125 | /** |
||
| 126 | * Class to use for page rendering |
||
| 127 | * |
||
| 128 | * @var string |
||
| 129 | * @config |
||
| 130 | */ |
||
| 131 | private static $page_class = Page::class; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * Default message set used in permission failures. |
||
| 135 | * |
||
| 136 | * @config |
||
| 137 | * @var array|string |
||
| 138 | */ |
||
| 139 | private static $default_message_set; |
||
| 140 | |||
| 141 | /** |
||
| 142 | * Random secure token, can be used as a crypto key internally. |
||
| 143 | * Generate one through 'sake dev/generatesecuretoken'. |
||
| 144 | * |
||
| 145 | * @config |
||
| 146 | * @var String |
||
| 147 | */ |
||
| 148 | private static $token; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * The default login URL |
||
| 152 | * |
||
| 153 | * @config |
||
| 154 | * |
||
| 155 | * @var string |
||
| 156 | */ |
||
| 157 | private static $login_url = "Security/login"; |
||
| 158 | |||
| 159 | /** |
||
| 160 | * The default logout URL |
||
| 161 | * |
||
| 162 | * @config |
||
| 163 | * |
||
| 164 | * @var string |
||
| 165 | */ |
||
| 166 | private static $logout_url = "Security/logout"; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * The default lost password URL |
||
| 170 | * |
||
| 171 | * @config |
||
| 172 | * |
||
| 173 | * @var string |
||
| 174 | */ |
||
| 175 | private static $lost_password_url = "Security/lostpassword"; |
||
| 176 | |||
| 177 | /** |
||
| 178 | * Value of X-Frame-Options header |
||
| 179 | * |
||
| 180 | * @config |
||
| 181 | * @var string |
||
| 182 | */ |
||
| 183 | private static $frame_options = 'SAMEORIGIN'; |
||
| 184 | |||
| 185 | /** |
||
| 186 | * Value of the X-Robots-Tag header (for the Security section) |
||
| 187 | * |
||
| 188 | * @config |
||
| 189 | * @var string |
||
| 190 | */ |
||
| 191 | private static $robots_tag = 'noindex, nofollow'; |
||
| 192 | |||
| 193 | /** |
||
| 194 | * Enable or disable recording of login attempts |
||
| 195 | * through the {@link LoginRecord} object. |
||
| 196 | * |
||
| 197 | * @config |
||
| 198 | * @var boolean $login_recording |
||
| 199 | */ |
||
| 200 | private static $login_recording = false; |
||
| 201 | |||
| 202 | /** |
||
| 203 | * @var boolean If set to TRUE or FALSE, {@link database_is_ready()} |
||
| 204 | * will always return FALSE. Used for unit testing. |
||
| 205 | */ |
||
| 206 | protected static $force_database_is_ready = null; |
||
| 207 | |||
| 208 | /** |
||
| 209 | * When the database has once been verified as ready, it will not do the |
||
| 210 | * checks again. |
||
| 211 | * |
||
| 212 | * @var bool |
||
| 213 | */ |
||
| 214 | protected static $database_is_ready = false; |
||
| 215 | |||
| 216 | /** |
||
| 217 | * @var string Default authenticator to use when none is given |
||
| 218 | */ |
||
| 219 | protected static $default_authenticator = 'default'; |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @var array available authenticators |
||
| 223 | */ |
||
| 224 | protected static $authenticators = []; |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @var Member Currently logged in user (if available) |
||
| 228 | */ |
||
| 229 | protected static $currentUser; |
||
| 230 | |||
| 231 | /** |
||
| 232 | * @return array |
||
| 233 | */ |
||
| 234 | public static function getAuthenticators() |
||
| 238 | |||
| 239 | /** |
||
| 240 | * @param array|\SilverStripe\Security\Authenticator $authenticators |
||
| 241 | */ |
||
| 242 | public static function setAuthenticators(array $authenticators) |
||
| 246 | |||
| 247 | /** |
||
| 248 | * @inheritdoc |
||
| 249 | */ |
||
| 250 | protected function init() |
||
| 266 | |||
| 267 | /** |
||
| 268 | * @inheritdoc |
||
| 269 | */ |
||
| 270 | public function index() |
||
| 274 | |||
| 275 | /** |
||
| 276 | * Get the selected authenticator for this request |
||
| 277 | * |
||
| 278 | * @param $name string The identifier of the authenticator in your config |
||
| 279 | * @return Authenticator Class name of Authenticator |
||
| 280 | * @throws LogicException |
||
| 281 | */ |
||
| 282 | protected function getAuthenticator($name = 'default') |
||
| 292 | |||
| 293 | /** |
||
| 294 | * Get all registered authenticators |
||
| 295 | * |
||
| 296 | * @param int $service The type of service that is requested |
||
| 297 | * @return array Return an array of Authenticator objects |
||
| 298 | */ |
||
| 299 | public function getApplicableAuthenticators($service = Authenticator::LOGIN) |
||
| 312 | |||
| 313 | /** |
||
| 314 | * Check if a given authenticator is registered |
||
| 315 | * |
||
| 316 | * @param string $authenticator The configured identifier of the authenicator |
||
| 317 | * @return bool Returns TRUE if the authenticator is registered, FALSE |
||
| 318 | * otherwise. |
||
| 319 | */ |
||
| 320 | public static function hasAuthenticator($authenticator) |
||
| 326 | |||
| 327 | /** |
||
| 328 | * Register that we've had a permission failure trying to view the given page |
||
| 329 | * |
||
| 330 | * This will redirect to a login page. |
||
| 331 | * If you don't provide a messageSet, a default will be used. |
||
| 332 | * |
||
| 333 | * @param Controller $controller The controller that you were on to cause the permission |
||
| 334 | * failure. |
||
| 335 | * @param string|array $messageSet The message to show to the user. This |
||
| 336 | * can be a string, or a map of different |
||
| 337 | * messages for different contexts. |
||
| 338 | * If you pass an array, you can use the |
||
| 339 | * following keys: |
||
| 340 | * - default: The default message |
||
| 341 | * - alreadyLoggedIn: The message to |
||
| 342 | * show if the user |
||
| 343 | * is already logged |
||
| 344 | * in and lacks the |
||
| 345 | * permission to |
||
| 346 | * access the item. |
||
| 347 | * |
||
| 348 | * The alreadyLoggedIn value can contain a '%s' placeholder that will be replaced with a link |
||
| 349 | * to log in. |
||
| 350 | * @return HTTPResponse |
||
| 351 | */ |
||
| 352 | public static function permissionFailure($controller = null, $messageSet = null) |
||
| 449 | |||
| 450 | public static function setCurrentUser($currentUser = null) |
||
| 454 | |||
| 455 | public static function getCurrentUser() |
||
| 459 | |||
| 460 | /** |
||
| 461 | * Get the login forms for all available authentication methods |
||
| 462 | * |
||
| 463 | * @deprecated 5.0.0 Now handled by {@link static::delegateToMultipleHandlers} |
||
| 464 | * |
||
| 465 | * @return array Returns an array of available login forms (array of Form |
||
| 466 | * objects). |
||
| 467 | * |
||
| 468 | */ |
||
| 469 | public function getLoginForms() |
||
| 480 | |||
| 481 | |||
| 482 | /** |
||
| 483 | * Get a link to a security action |
||
| 484 | * |
||
| 485 | * @param string $action Name of the action |
||
| 486 | * @return string Returns the link to the given action |
||
| 487 | */ |
||
| 488 | public function Link($action = null) |
||
| 493 | |||
| 494 | /** |
||
| 495 | * This action is available as a keep alive, so user |
||
| 496 | * sessions don't timeout. A common use is in the admin. |
||
| 497 | */ |
||
| 498 | public function ping() |
||
| 502 | |||
| 503 | /** |
||
| 504 | * Log the currently logged in user out |
||
| 505 | * |
||
| 506 | * Logging out without ID-parameter in the URL, will log the user out of all applicable Authenticators. |
||
| 507 | * |
||
| 508 | * Adding an ID will only log the user out of that Authentication method. |
||
| 509 | * |
||
| 510 | * Logging out of Default will <i>always</i> completely log out the user. |
||
| 511 | * |
||
| 512 | * @param bool $redirect Redirect the user back to where they came. |
||
| 513 | * - If it's false, the code calling logout() is |
||
| 514 | * responsible for sending the user where-ever |
||
| 515 | * they should go. |
||
| 516 | * @return HTTPResponse|null |
||
| 517 | */ |
||
| 518 | public function logout($redirect = true) |
||
| 547 | |||
| 548 | /** |
||
| 549 | * Perform pre-login checking and prepare a response if available prior to login |
||
| 550 | * |
||
| 551 | * @return HTTPResponse Substitute response object if the login process should be curcumvented. |
||
| 552 | * Returns null if should proceed as normal. |
||
| 553 | */ |
||
| 554 | protected function preLogin() |
||
| 587 | |||
| 588 | /** |
||
| 589 | * Prepare the controller for handling the response to this request |
||
| 590 | * |
||
| 591 | * @param string $title Title to use |
||
| 592 | * @return Controller |
||
| 593 | */ |
||
| 594 | protected function getResponseController($title) |
||
| 619 | |||
| 620 | /** |
||
| 621 | * Combine the given forms into a formset with a tabbed interface |
||
| 622 | * |
||
| 623 | * @param $forms |
||
| 624 | * @return string |
||
| 625 | */ |
||
| 626 | protected function generateLoginFormSet($forms) |
||
| 636 | |||
| 637 | /** |
||
| 638 | * Get the HTML Content for the $Content area during login |
||
| 639 | * |
||
| 640 | * @param string &$messageType Type of message, if available, passed back to caller |
||
| 641 | * @return string Message in HTML format |
||
| 642 | */ |
||
| 643 | protected function getLoginMessage(&$messageType = null) |
||
| 659 | |||
| 660 | /** |
||
| 661 | * Set the next message to display for the security login page. Defaults to warning |
||
| 662 | * |
||
| 663 | * @param string $message Message |
||
| 664 | * @param string $messageType Message type. One of ValidationResult::TYPE_* |
||
| 665 | * @param string $messageCast Message cast. One of ValidationResult::CAST_* |
||
| 666 | */ |
||
| 667 | public function setLoginMessage( |
||
| 676 | |||
| 677 | /** |
||
| 678 | * Clear login message |
||
| 679 | */ |
||
| 680 | public static function clearLoginMessage() |
||
| 684 | |||
| 685 | |||
| 686 | /** |
||
| 687 | * Show the "login" page |
||
| 688 | * |
||
| 689 | * For multiple authenticators, Security_MultiAuthenticatorLogin is used. |
||
| 690 | * See getTemplatesFor and getIncludeTemplate for how to override template logic |
||
| 691 | * |
||
| 692 | * @param $request |
||
| 693 | * @return HTTPResponse|string Returns the "login" page as HTML code. |
||
| 694 | * @throws HTTPResponse_Exception |
||
| 695 | */ |
||
| 696 | public function login($request = null, $service = Authenticator::LOGIN) |
||
| 741 | |||
| 742 | /** |
||
| 743 | * Delegate to an number of handlers, extracting their forms and rendering a tabbed form-set. |
||
| 744 | * This is used to built the log-in page where there are multiple authenticators active. |
||
| 745 | * |
||
| 746 | * If a single handler is passed, delegateToHandler() will be called instead |
||
| 747 | * |
||
| 748 | * @param string $title The title of the form |
||
| 749 | * @param array $templates |
||
| 750 | * @return array|HTTPResponse|RequestHandler|\SilverStripe\ORM\FieldType\DBHTMLText|string |
||
| 751 | */ |
||
| 752 | protected function delegateToMultipleHandlers(array $handlers, $title, array $templates) |
||
| 792 | |||
| 793 | /** |
||
| 794 | * Delegate to another RequestHandler, rendering any fragment arrays into an appropriate. |
||
| 795 | * controller. |
||
| 796 | * |
||
| 797 | * @param string $title The title of the form |
||
| 798 | * @param array $templates |
||
| 799 | * @return array|HTTPResponse|RequestHandler|\SilverStripe\ORM\FieldType\DBHTMLText|string |
||
| 800 | */ |
||
| 801 | protected function delegateToHandler(RequestHandler $handler, $title, array $templates) |
||
| 813 | |||
| 814 | /** |
||
| 815 | * Render the given fragments into a security page controller with the given title. |
||
| 816 | * @param string $title string The title to give the security page |
||
| 817 | * @param array $fragments A map of objects to render into the page, e.g. "Form" |
||
| 818 | * @param array $templates An array of templates to use for the render |
||
| 819 | * @return HTTPResponse|\SilverStripe\ORM\FieldType\DBHTMLText |
||
| 820 | */ |
||
| 821 | protected function renderWrappedController($title, array $fragments, array $templates) |
||
| 848 | |||
| 849 | public function basicauthlogin() |
||
| 854 | |||
| 855 | /** |
||
| 856 | * Show the "lost password" page |
||
| 857 | * |
||
| 858 | * @return string Returns the "lost password" page as HTML code. |
||
| 859 | */ |
||
| 860 | public function lostpassword() |
||
| 872 | |||
| 873 | /** |
||
| 874 | * Show the "change password" page. |
||
| 875 | * This page can either be called directly by logged-in users |
||
| 876 | * (in which case they need to provide their old password), |
||
| 877 | * or through a link emailed through {@link lostpassword()}. |
||
| 878 | * In this case no old password is required, authentication is ensured |
||
| 879 | * through the Member.AutoLoginHash property. |
||
| 880 | * |
||
| 881 | * @see ChangePasswordForm |
||
| 882 | * |
||
| 883 | * @return string|HTTPRequest Returns the "change password" page as HTML code, or a redirect response |
||
| 884 | */ |
||
| 885 | public function changepassword() |
||
| 972 | |||
| 973 | /** |
||
| 974 | * Create a link to the password reset form. |
||
| 975 | * |
||
| 976 | * GET parameters used: |
||
| 977 | * - m: member ID |
||
| 978 | * - t: plaintext token |
||
| 979 | * |
||
| 980 | * @param Member $member Member object associated with this link. |
||
| 981 | * @param string $autologinToken The auto login token. |
||
| 982 | * @return string |
||
| 983 | */ |
||
| 984 | public static function getPasswordResetLink($member, $autologinToken) |
||
| 990 | |||
| 991 | /** |
||
| 992 | * Factory method for the lost password form |
||
| 993 | * |
||
| 994 | * @skipUpgrade |
||
| 995 | * @return MemberAuthenticator\ChangePasswordForm |
||
| 996 | */ |
||
| 997 | public function ChangePasswordForm() |
||
| 1001 | |||
| 1002 | /** |
||
| 1003 | * Determine the list of templates to use for rendering the given action. |
||
| 1004 | * |
||
| 1005 | * @skipUpgrade |
||
| 1006 | * @param string $action |
||
| 1007 | * @return array Template list |
||
| 1008 | */ |
||
| 1009 | public function getTemplatesFor($action) |
||
| 1023 | |||
| 1024 | /** |
||
| 1025 | * Return an existing member with administrator privileges, or create one of necessary. |
||
| 1026 | * |
||
| 1027 | * Will create a default 'Administrators' group if no group is found |
||
| 1028 | * with an ADMIN permission. Will create a new 'Admin' member with administrative permissions |
||
| 1029 | * if no existing Member with these permissions is found. |
||
| 1030 | * |
||
| 1031 | * Important: Any newly created administrator accounts will NOT have valid |
||
| 1032 | * login credentials (Email/Password properties), which means they can't be used for login |
||
| 1033 | * purposes outside of any default credentials set through {@link Security::setDefaultAdmin()}. |
||
| 1034 | * |
||
| 1035 | * @return Member |
||
| 1036 | */ |
||
| 1037 | public static function findAnAdministrator() |
||
| 1088 | |||
| 1089 | /** |
||
| 1090 | * Flush the default admin credentials |
||
| 1091 | */ |
||
| 1092 | public static function clear_default_admin() |
||
| 1097 | |||
| 1098 | |||
| 1099 | /** |
||
| 1100 | * Set a default admin in dev-mode |
||
| 1101 | * |
||
| 1102 | * This will set a static default-admin which is not existing |
||
| 1103 | * as a database-record. By this workaround we can test pages in dev-mode |
||
| 1104 | * with a unified login. Submitted login-credentials are first checked |
||
| 1105 | * against this static information in {@link Security::authenticate()}. |
||
| 1106 | * |
||
| 1107 | * @param string $username The user name |
||
| 1108 | * @param string $password The password (in cleartext) |
||
| 1109 | * @return bool True if successfully set |
||
| 1110 | */ |
||
| 1111 | public static function setDefaultAdmin($username, $password) |
||
| 1123 | |||
| 1124 | /** |
||
| 1125 | * Checks if the passed credentials are matching the default-admin. |
||
| 1126 | * Compares cleartext-password set through Security::setDefaultAdmin(). |
||
| 1127 | * |
||
| 1128 | * @param string $username |
||
| 1129 | * @param string $password |
||
| 1130 | * @return bool |
||
| 1131 | */ |
||
| 1132 | public static function check_default_admin($username, $password) |
||
| 1140 | |||
| 1141 | /** |
||
| 1142 | * Check that the default admin account has been set. |
||
| 1143 | */ |
||
| 1144 | public static function has_default_admin() |
||
| 1148 | |||
| 1149 | /** |
||
| 1150 | * Get default admin username |
||
| 1151 | * |
||
| 1152 | * @return string |
||
| 1153 | */ |
||
| 1154 | public static function default_admin_username() |
||
| 1158 | |||
| 1159 | /** |
||
| 1160 | * Get default admin password |
||
| 1161 | * |
||
| 1162 | * @return string |
||
| 1163 | */ |
||
| 1164 | public static function default_admin_password() |
||
| 1168 | |||
| 1169 | /** |
||
| 1170 | * Encrypt a password according to the current password encryption settings. |
||
| 1171 | * If the settings are so that passwords shouldn't be encrypted, the |
||
| 1172 | * result is simple the clear text password with an empty salt except when |
||
| 1173 | * a custom algorithm ($algorithm parameter) was passed. |
||
| 1174 | * |
||
| 1175 | * @param string $password The password to encrypt |
||
| 1176 | * @param string $salt Optional: The salt to use. If it is not passed, but |
||
| 1177 | * needed, the method will automatically create a |
||
| 1178 | * random salt that will then be returned as return value. |
||
| 1179 | * @param string $algorithm Optional: Use another algorithm to encrypt the |
||
| 1180 | * password (so that the encryption algorithm can be changed over the time). |
||
| 1181 | * @param Member $member Optional |
||
| 1182 | * @return mixed Returns an associative array containing the encrypted |
||
| 1183 | * password and the used salt in the form: |
||
| 1184 | * <code> |
||
| 1185 | * array( |
||
| 1186 | * 'password' => string, |
||
| 1187 | * 'salt' => string, |
||
| 1188 | * 'algorithm' => string, |
||
| 1189 | * 'encryptor' => PasswordEncryptor instance |
||
| 1190 | * ) |
||
| 1191 | * </code> |
||
| 1192 | * If the passed algorithm is invalid, FALSE will be returned. |
||
| 1193 | * |
||
| 1194 | * @see encrypt_passwords() |
||
| 1195 | */ |
||
| 1196 | public static function encrypt_password($password, $salt = null, $algorithm = null, $member = null) |
||
| 1215 | |||
| 1216 | /** |
||
| 1217 | * Checks the database is in a state to perform security checks. |
||
| 1218 | * See {@link DatabaseAdmin->init()} for more information. |
||
| 1219 | * |
||
| 1220 | * @return bool |
||
| 1221 | */ |
||
| 1222 | public static function database_is_ready() |
||
| 1270 | |||
| 1271 | /** |
||
| 1272 | * Resets the database_is_ready cache |
||
| 1273 | */ |
||
| 1274 | public static function clear_database_is_ready() |
||
| 1279 | |||
| 1280 | /** |
||
| 1281 | * For the database_is_ready call to return a certain value - used for testing |
||
| 1282 | */ |
||
| 1283 | public static function force_database_is_ready($isReady) |
||
| 1287 | |||
| 1288 | /** |
||
| 1289 | * Enable or disable recording of login attempts |
||
| 1290 | * through the {@link LoginRecord} object. |
||
| 1291 | * |
||
| 1292 | * @deprecated 4.0 Use the "Security.login_recording" config setting instead |
||
| 1293 | * @param boolean $bool |
||
| 1294 | */ |
||
| 1295 | public static function set_login_recording($bool) |
||
| 1300 | |||
| 1301 | /** |
||
| 1302 | * @deprecated 4.0 Use the "Security.login_recording" config setting instead |
||
| 1303 | * @return boolean |
||
| 1304 | */ |
||
| 1305 | public static function login_recording() |
||
| 1311 | |||
| 1312 | /** |
||
| 1313 | * @config |
||
| 1314 | * @var string Set the default login dest |
||
| 1315 | * This is the URL that users will be redirected to after they log in, |
||
| 1316 | * if they haven't logged in en route to access a secured page. |
||
| 1317 | * By default, this is set to the homepage. |
||
| 1318 | */ |
||
| 1319 | private static $default_login_dest = ""; |
||
| 1320 | |||
| 1321 | protected static $ignore_disallowed_actions = false; |
||
| 1322 | |||
| 1323 | /** |
||
| 1324 | * Set to true to ignore access to disallowed actions, rather than returning permission failure |
||
| 1325 | * Note that this is just a flag that other code needs to check with Security::ignore_disallowed_actions() |
||
| 1326 | * @param $flag True or false |
||
| 1327 | */ |
||
| 1328 | public static function set_ignore_disallowed_actions($flag) |
||
| 1332 | |||
| 1333 | public static function ignore_disallowed_actions() |
||
| 1337 | |||
| 1338 | /** |
||
| 1339 | * Get the URL of the log-in page. |
||
| 1340 | * |
||
| 1341 | * To update the login url use the "Security.login_url" config setting. |
||
| 1342 | * |
||
| 1343 | * @return string |
||
| 1344 | */ |
||
| 1345 | public static function login_url() |
||
| 1349 | |||
| 1350 | |||
| 1351 | /** |
||
| 1352 | * Get the URL of the logout page. |
||
| 1353 | * |
||
| 1354 | * To update the logout url use the "Security.logout_url" config setting. |
||
| 1355 | * |
||
| 1356 | * @return string |
||
| 1357 | */ |
||
| 1358 | public static function logout_url() |
||
| 1362 | |||
| 1363 | /** |
||
| 1364 | * Get the URL of the logout page. |
||
| 1365 | * |
||
| 1366 | * To update the logout url use the "Security.logout_url" config setting. |
||
| 1367 | * |
||
| 1368 | * @return string |
||
| 1369 | */ |
||
| 1370 | public static function lost_password_url() |
||
| 1374 | |||
| 1375 | /** |
||
| 1376 | * Defines global accessible templates variables. |
||
| 1377 | * |
||
| 1378 | * @return array |
||
| 1379 | */ |
||
| 1380 | public static function get_template_global_variables() |
||
| 1390 | } |
||
| 1391 |