104 Commits

Author SHA1 Message Date
Sara Arjona
4816fec3fa MDL-72945 badges: use default issuer contact
The defaultissuercontact was ignored if the sitebackpack email was set
to empty string..
2021-10-28 17:43:49 +02:00
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
Sara Arjona
50e9e5b2bd MDL-69792 core_badges: deprecated backpack.js and BADGE_BACKPACKURL
Final deprecation for constant BADGE_BACKPACKURL (it has been removed)
and badges/backpack.js file (it has been removed too).
Besides, some methods have started the deprecation process too:
 - badges_check_backpack_accessibility
 - badges_setup_backpack_js()
 - badges_local_backpack_js()

Apart from that, string 'addbackpack' has been deprecated here
because it's not used anywhere.
2021-03-19 15:13:03 +01:00
Jun Pataleta
5a7c629f7c Merge branch 'MDL-45242-master' of https://github.com/sammarshallou/moodle 2021-03-10 23:39:30 +08: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
Sara Arjona
49c1d41a60 MDL-70911 core_badges: Remove $CFG->badges_site_backpack
The $CFG->badges_site_backpack setting has been completely removed
because it's not required anymore. From now, the primary site
backpack will be the first one in the "Manage backpacks" list (so,
the one with lower sortorder value).
2021-03-10 09:09:05 +01:00
Sara Arjona
066e998400 MDL-70911 core_badges: Add support to backpacks sortorder
Before removing $CFG->badges_site_backpack setting, admins should be
able to re-order the existing site-backpacks (because then, the first
one will be treated as the default one).
This patch adds the sort order feature to the backpack list.
2021-03-10 08:29:47 +01:00
Sara Arjona
9e5655b7c7 MDL-70913 core_badges: Use and update properly sortorder
Sortorder field in badge_external_backpack was updated with a wrong
value. This patch fixes this behaviour and adds sortorder as
sorting criteria for displaying the list of site backpacks.

In the phpunit method reviewed for covering this, a couple of
assertEquals() calls have been changed too to put the expected value
first.
2021-03-01 13:04:00 +01:00
Sara Arjona
ee0c9d2efd MDL-70059 core_badges: avoid duplicate key error
When 2 or more backpack were created without credentials,
a "Duplicate key value violates unique constraint" error
was raised because externalbackpackid was not taking the
correct value.
Other improvements have been done to the code too in order
to make it more readable.
2020-11-02 10:41:38 +01:00
Peter Dias
d3af959238 MDL-65959 badge: Enable OB2.1 *connection* with cross domain ability 2020-10-27 00:27:20 +08:00
Peter Dias
96ec45cb17 MDL-65959 badges: Do not use badge user preference after verification 2020-10-27 00:27:19 +08:00
Peter Dias
3cae9421a8 MDL-65959 badges: Update the implementation to use admin set backpack 2020-10-27 00:27:19 +08:00
Peter
b6435e0934 MDL-65959 core_badges: Allow ability to upload badges cross domain. 2020-10-27 00:27:18 +08:00
Peter
1c4620bce6 MDL-65959 core_badges: Unrestricted user's badger account
* Restructure the email to be backpack specific
* Amended table defintion and functions
2020-10-25 23:03:59 +08:00
Bas Brands
4394f9e358 MDL-67735 theme_boost: remove bs2 and bs4alpha compatibility css 2020-08-17 08:16:42 +00:00
Sara Arjona
3e567085a8 MDL-69002 core_badges: add methods to support backpack validation
A more generic method has been added to the API to validate the
backpack connection (for now, there was only one method for
validating current backpack).
Besides, a renderer has been added to display this information
depending on the backpackid.
2020-06-10 12:26:47 +02:00
Sara Arjona
a80541ea90 MDL-68567 badges: add/remove site backpacks 2020-05-22 09:01:59 +02:00
Tung Thai
15a00bead1 MDL-66992 core_badges: Add support to Open Badges 2.1 2020-05-17 20:01:55 +07:00
Sara Arjona
f958f5c19b MDL-66357 core_badges: remove mozilla backpack references
Mozilla backpack closed a few months ago. It was moved to Badgr.io
(as OBv1.0) but as we're also supporting Badgr.io OBv2.0, it
makes no sense to leave old references to Mozilla backpack there.
2020-04-03 08:09:55 +02:00
Sara Arjona
2f45b6f7cf MDL-67971 core_badges: review issuer URL 2020-03-02 08:02:08 +01:00
Sara Arjona
f8d9b1eb8c MDL-49103 badges: bake badges with iTXt chunk instead of tEXt
The final OB 1.0 specification changed the baking badges method
from tEXt to iTXt. Besides, the iTXt chunk should be a signed
assertion or the raw JSON (instead of the assertion URL).
This has been changed in order to make Moodle OB compliant.

Yuliya Bozhko, thanks for the patch! :-)
2020-02-04 18:49:39 +01:00
Eloy Lafuente (stronk7)
4e202d91e7 Merge branch 'MDL-65243-master' of git://github.com/mihailges/moodle 2019-10-13 16:31:14 +02:00
Damyon Wiese
b0213770d2 MDL-65243 badges: Use real time api
Never add or subtract timestamps - use the time api to do it correctly.
2019-10-09 11:51:45 +08:00
Mihail Geshoski
9ad5cff41f MDL-65515 badges: Split install/upgrade
Use badges/upgradelib.php for functions that only affect install/upgrade.

All credit goes to Damyon Wiese.
2019-10-09 11:15:28 +08:00
Damyon Wiese
084a42f9f5 MDL-65518 badges: Require the issuercontact
For Badges V2 we can't use just any email address to issue badges, it needs to be a valid
account on the backpack.
2019-05-10 15:51:27 +08:00
Damyon Wiese
2fe34536d5 MDL-65518 badges: Retry auth test
When testing the site backpack login credentials, don't rely on a previous login
because the username and password could have changed.
2019-05-09 14:56:27 +08:00
Damyon Wiese
c659b1c53d MDL-65518 badges: Default Issuer name
If the issuer name is not set, use the site name.
2019-05-09 14:56:27 +08:00
Damyon Wiese
d48a52ddb1 MDL-65518 badges: Admin settings warning
If the backpack is changed to Open Badges V2 backpack,
attempt the authenticate with the site settings and return a warning
if it fails.
2019-05-09 14:56:21 +08:00
Damyon Wiese
7444ba743f MDL-63262 badges: More changes for badgr.io
This commit combines several changes:
* Show authentication errors.
* Show more detailed authentication errors
* When the site backpack is different to the user backpack, show a warning
* Do not duplicate the apiversion and backpackurls in each user backpack.
* Do not support different issuer information for each badge with Open Badges v2.
* Add obversion to assertion url
* Combine separate badges upgrade steps and bump the version number.
* Don't show private collections.
* Push the larger image size to backpacks (512x512).
* BADGE_BACKPACKURL is deprecated
* Don't use property alignments, only alignment
2019-05-03 15:00:01 +08:00
Damyon Wiese
1837b1d5fd MDL-63262 badges: Coding style 2019-05-03 15:00:00 +08:00
Damyon Wiese
aae219acce MDL-63262 badges: Add badgr.io
Upgrade the support for Open Badges 2 to support a real open badges 2 backpack.
Moodle can only talk to one backpack at a time, so after switching backpacks, users
will have to manually disconnect and then reconnect their backpack to the new one.

This commit combines several changes:
* Split classes into badges namespace
* Publish expiry data with a badge
* Publish badge alignments in badges exported to the backpack.
* Export the criteria for a badge to the backpack.
2019-05-03 15:00:00 +08:00
Sara Arjona
bef6805656 Merge branch 'MDL-64702-master' of git://github.com/damyon/moodle 2019-04-29 08:34:21 +02:00
Juan Leyva
36fa0ec900 MDL-60680 notifications: Return custom data in notifications 2019-04-25 14:55:18 +02:00
Damyon Wiese
b3337bd5a4 MDL-64702 badges: Add missing data to backup
Backup and restore of badges is missing data:
* alignments
* endorsement

Also added to "clone" (duplicate a badge).
2019-04-23 11:14:00 +08:00
Eloy Lafuente (stronk7)
dabc69afe5 Merge branch 'MDL-65191-master' of git://github.com/lameze/moodle 2019-04-09 00:46:47 +02:00
Simey Lameze
7c36d66982 MDL-65191 core: shift badge_assemble_notification to badgeslib 2019-04-04 09:36:13 +08:00
Damyon Wiese
f44557d045 MDL-63876 badges: Competency deletion
Do not delete a competency if it is a criteria for a badge.
2019-03-29 11:31:15 +08:00
Damyon Wiese
8aff6f6f14 MDL-63876 badges: Coding style
Add comments to document function params and template example context.
2019-03-29 11:31:15 +08:00
Damyon Wiese
43f1c8e23c MDL-63876 badges: Allow criteria to be optional
Competencies criteria type is only added if competencies are enabled.
2019-03-29 11:31:15 +08:00
Damyon Wiese
f94786e0e1 MDL-63876 badges: Add competency criteria
Properly integration badges with competencies provided in Moodle.

Automatically grant the badge when the defined competencies are marked as proficient.
2019-03-29 11:31:15 +08:00
Damyon Wiese
e8bfd9b4a9 MDL-63876 badges: Remove invalid table from badges 2019-03-29 11:30:09 +08:00
Jake Dallimore
1dee827c39 MDL-63973 core_badges: related badges query now works both ways
If A is related to B, then we should be able to view this relationship
from both badge A and badge B. The following badge methods were updated:
- get_related_badges()
- has_related()
- delete_related_badge()
2018-11-19 11:08:00 +08:00
Jun Pataleta
9639cb487e MDL-58454 badges: Fix related badge deletion
* When deleting a badge, delete badge_related records where this badge
is also set as the related badge.
2018-11-06 11:47:20 +08:00
Sara Arjona
5a1ea82835 MDL-58454 badges: Fix some minor errors for Open Badges v2 2018-11-05 18:41:54 +01:00
Tung Thai
d363a5c2e6 MDL-58454 badges: Open Badges Specification Version 2.0 Changes 2018-11-05 14:20:46 +01:00
Charles Fulton
49b464f814 MDL-58000 badges: use large image when baking 2018-09-25 10:46:05 -04:00
Eugene Venter
abc07b53a7 MDL-55491 badges: Add cohort as badge criteria
commissioned by NZ Customs Service
2018-04-09 10:23:50 +02:00
Andrew Nicols
389aad6eef MDL-61221 badges: Ignore site availabilty for behat
Behat sites should not be available publically, and the check against
the backpack API for site availablity can time out in some situations.

We should be testing as though the site _is_ available, as this is the
standard expectation.
2018-01-16 13:21:51 +08:00
Damyon Wiese
a569a33097 Merge branch 'MDL-59875_m35v1' of https://github.com/sbourget/moodle 2017-12-06 19:53:31 +13:00
Stephen Bourget
a7370e0dd0 MDL-59875 Badges: Allow badges to be criteria for other badges 2017-11-28 08:03:02 -05:00