MDL-61844 policy: Avoid to accept new policies during current session
Avoid redirection for accepting new policies during the manager user session when $user->policyagreed=0 and he/she activates the first policy for logged in users. Part of MDL-61864
This commit is contained in:
committed by
Marina Glancy
parent
3f9b276b97
commit
4e9e2b0a0a
@@ -551,4 +551,19 @@ class tool_policy_api_testcase extends advanced_testcase {
|
||||
$this->assertEquals(1, $DB->count_records('tool_policy_acceptances',
|
||||
['userid' => $user2->id, 'policyversionid' => $policy->id]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that user can login if sitepolicyhandler is set but there are no policies.
|
||||
*/
|
||||
public function test_login_with_handler_without_policies() {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$CFG->sitepolicyhandler = 'tool_policy';
|
||||
|
||||
require_login(null, false, null, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user