Ver código fonte

Reset course access if login comes from another page than login

The parameter "redirect_after_not_allow_page" is set when
entering a course page but we don't have access, so the user have to
enter login/password, after entering the course access should be reset
with the new permissions.

BT#14219
jmontoyaa 7 anos atrás
pai
commit
0a618726bb
1 arquivos alterados com 7 adições e 0 exclusões
  1. 7 0
      main/inc/local.inc.php

+ 7 - 0
main/inc/local.inc.php

@@ -359,6 +359,13 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
                 if (($validPassword || $cas_login) &&
                     (trim($login) == $uData['username'])
                 ) {
+                    // Means that the login was loaded in a different page than index.php
+                    // we force the reload of the course access using cidReset just in case
+                    if (isset($_REQUEST['redirect_after_not_allow_page']) &&
+                        $_REQUEST['redirect_after_not_allow_page'] == 1
+                    ) {
+                        $cidReset = true;
+                    }
                     $update_type = UserManager::get_extra_user_data_by_field(
                         $uData['user_id'],
                         'update_type'