13 Commits

Author SHA1 Message Date
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00:00
David Mudrák
ad5e2135c5 MDL-62309 tool_policy: Improve permission evaluation methods
Please refer to the unit tests for the specification of the expected
behaviour.
2018-10-22 08:49:36 +02:00
David Mudrák
4a742e4f94 MDL-62309 tool_policy: Update user acceptances reports
This adds support for optional policies to the user acceptance reports.
Distinguished are "Pending" acceptances (we did not hear yet) from
"Declined" (user did not agree). The status workflow updated to support
new transitions: pending -> declined and declined -> accepted.
2018-10-22 08:49:36 +02:00
David Mudrák
5348b1eef5 MDL-62309 tool_policy: Optional policies can be declined by the user
For optional policies, we provide a radio selector to let the user
choose the acceptance status on the consent page. For policies displayed
on their own page, we display a link to decline the policy.

The way how we pass the list of policy version ids to index.php has
changed so that we can now not only pass the list of ids, but also the
actual acceptance status (accepted / declined).
2018-10-22 08:49:36 +02:00
David Mudrák
faf4222edc MDL-62309 tool_policy: Add api::get_agreement_optional() method
This method allows to quickly check if the given policy version is
marked as optional or compulsory. This will be needed in other places
such as permissions check.
2018-10-22 08:49:36 +02:00
David Mudrák
1617fde9a8 MDL-62309 tool_policy: New API method to decline a policy
Policy can be declined. Optional policies do not need to be accepted to
use the site. But we still want to hear explicitly from the user.
2018-10-22 08:49:36 +02:00
David Mudrák
f98cd91a13 MDL-62309 tool_policy: Improve api::is_user_version_accepted() return
The method now returns three-state logic. A bool value true/false is
returned if the user has accepted/rejected the policy, respectively. A
null value is returned if the user did not express their agreement in
either way yet.

This allows to distinguish between "rejected the policy" and "did not
say anything about it yet" cases.
2018-10-22 08:49:36 +02:00
Sara Arjona
461b1931c0 MDL-62062 tool_policy: Let manager/dpo withdraw consent to policies
The policies can be revoked by clicking the "Agreed [on behalf]" ticks.
A message has been added also to explain users they must contact to
the DPO if they want to withdraw their consent to policies.
2018-05-07 10:11:13 +02:00
Marina Glancy
e8cf2ffd61 MDL-61939 tool_policy: usermodified should be realuser
When logged in as another user and accept the policies on somebody else's behalf make sure that
usermodified is recorded as real user
2018-04-23 09:45:26 +08:00
Sara Arjona
4e9e2b0a0a 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
2018-04-16 11:30:14 +08:00
Marina Glancy
cc3790d0ea MDL-61864 tool_policy: function can_delete_version
review TODOs in code, make sure they are either removed or tracker issues are created
2018-04-16 11:30:13 +08:00
David Mudrák
3d9571d5f0 MDL-61864 tool_policy: management of the site policies 2018-04-16 11:30:10 +08:00