Commit Graph

44 Commits

Author SHA1 Message Date
77f85ed287 MDL-75316 core: Add activity sender & moodlenet_client to MoodleNet API
This makes it possible to share a single activity to a MoodleNet
instance (which has been enabled for sharing in site admin).
This utilises the core\moodlenet\activity_packager to create an
activity backup, then sends it using the MoodleNet create resource
API specification.

Originally implemented as MDL-75932
2023-04-18 17:04:14 +08:00
e0d7ab9989 MDL-76380 tool_oauth2: remove double persistent load on update.
The method already loaded the validated persistent model data on the
previous line, there's no need to do it again (while also trying to
load unvalidated properties).
2022-11-28 19:38:47 +00:00
b76ac53c9d MDL-61880 core: don't clear issuer fields not present in form data
In cases where we have an id, load the persistent and then set new data
before saving. This ensures we don't delete fields which are missing in
the form data.
2022-11-02 11:11:00 +08:00
52d523fa9c MDL-61880 core: Retain OAuth 2.0 user field mappings after issuer update 2022-11-02 11:10:36 +08:00
e8898b3bd9 MDL-71593 oauth2: Remove methods that were readded by mistake. 2021-06-21 10:11:16 +02:00
8e71f6b1f1 MDL-65637 core_oauth2: Introduce a new custom linkedin oauth2 client 2021-06-02 08:11:38 +08:00
8a53fe7f6b Merge branch 'MDL-28452-master' of git://github.com/bmbrands/moodle 2021-04-22 09:38:50 +08:00
f9e1c2587a MDL-28452 core_user: migrate social profile fields
Create a new profile field type, move all existing content of the fields
'icq', 'skype', 'aim', 'yahoo', 'msn' and 'url' in the mdl_user table to
theses new profile fields if needed.

AMOS BEGIN
MOV [aimid,core],[aimid,courseimage,profilefield_social]
MOV [yahooid,core],[yahooid,profilefield_social]
MOV [skypeid,core],[skypeid,profilefield_social]
MOV [icqnumber,core],[icqnumber,profilefield_social]
MOV [msnid,core],[msnid,profilefield_social]
MOV [webpage,core],[webpage,profilefield_social]
AMOS END
2021-04-21 11:22:25 +02:00
57a444d31f MDL-71017 oath2: configuration check fix and return types 2021-04-20 12:07:54 +02:00
0152fdbdff MDL-71017 oauth2: configure some oauth2 services for login only 2021-04-20 10:50:40 +02:00
7afda52e62 MDL-70722 oauth2: move Nextcloud methods to service class 2021-03-26 09:20:52 +01:00
fdaa958ff7 MDL-70722 oauth2: move Microsoft methods to service class 2021-03-26 09:20:52 +01:00
0b53d70ae9 MDL-70722 oauth2: move Facebook methods to service class 2021-03-26 09:20:52 +01:00
5066c60206 MDL-70689 oauth2: add support to IMS OBv2.1 service
In order to make easier to create and maintain new OAuth2 services,
a couple of classes have been added:

- discovery\* contains methods related to the discovery system. Until
now, only OpenID Connect was supported by Moodle so all the code was
centralised in api.php.
With this patch, as IMS OBv2.1 has a different discovery system, a new
abstract class (base_definition) has been added to be called and let
every discovery system (OpenID Connect, IMS Badge Connect...)
implement their own methods.

- service\* . Instead of keep adding methods to the api, the service
namespace has been created to store all the standard issuer services.
An interface (issuer_interface) has been created and all the services
should implement it.
This patch creates the "IMS OBv2.1" and "Custom" services and moves
the methods for "Google" service because it uses the OpenID connect
discovery system.
2021-03-12 12:31:22 +01:00
0132037427 MDL-59510 core_oauth2: add autorefresh mode to oauth2\client
Changes:
- The client can now be instantiated with the new mode enabled.
- A user refresh token will be stored if returned as part of the
authorization_code grant but only if the user is authenticated and only
if the mode is enabled.
- If the mode permits it, attempt to exchange a stored refresh token for
a new access token during login checks, allowing access to continue
across sessions without the need to re-grant consent every time.
- Purge all refresh tokens for a given user, issuer and scope on client
log out. This makes sure logout persists across logins.
2020-10-05 09:19:29 +08:00
4b0cf053dc MDL-64206 core: updated FB logo URL 2018-12-03 12:20:51 +08:00
3559677cb7 MDL-64078 oauth2: Google service relies on autodiscovery 2018-11-20 16:43:35 +01:00
3e3e120d3a MDL-58943 oauth2: Added nextcloud to standard issuers
* New button allows to create standard issuer for nextcloud
* Since the endpoints url has to be https and nextcloud relys on the
baseurl to create the endpoints, the baseurl of issuers has now to be
https as well (or empty).
* Google's baseurl was changed to https (there was no reason not to),
whereas Facebook and Microsoft baseurls remain empty.
* In case of the creation of a nextcloud issuer, the baseurl is
required.
* Nextcloud requires the baseurl, therefore a parameter is added to
create_standard_issuer($type, $baseurl = false). That parameter not
required (or used) for anything but Nextcloud.
2018-10-31 10:42:58 +08:00
fa6cd89b24 MDL-58943 oauth2: Split issuer initialization from endpoint creation
* Splitted the initialization of default values for issuers, the
creation of the issuer, and the creation of its endpoints. This is
a fix for following use case:
 1. A user creates a standard issuer.
 2. She cancels the form.
 3. However, the issuer was already created. Thus, the cancel had no
effect.
* The function create_standard_issuer($type) can still be used to create
issuers programmatically if all required data is known beforehand (e.g.,
during upgrade or in tests).
2018-10-31 10:42:57 +08:00
7766dbed5d MDL-61826 auth: Make Facebook endpoints more maintainable 2018-06-06 12:44:24 +08:00
ac45c16544 MDL-61826 auth: Facebook OAuth2 - getting a better-quality profile photo
Get 200x200 px instead of 50x50 px user profile picture from Facebook OAuth2.
2018-06-06 12:09:09 +08:00
02cc1ecd77 MDL-62316 OAuth 2: Only guess image if base URL set.
If you added an OAuth 2 service with no base URL guess_image() would try to
parse this empty value looking for a favicon.ico.  We now check if the base
URL is empty beforehand and skip this if so.
2018-05-22 17:43:05 +01:00
65bcb7da0e MDL-61827 auth: Change Facebook Graph API v2.8 to v.2.12 in OAuth2
Use v2.12 Facebook Graph API instead of v2.8
2018-04-13 21:40:42 +02:00
7927138d50 MDL-59855 oauth2: More PHPDocs fixes
* Fix PHPDoc return type for api::get_system_account()
* Fix PHPDoc for the $contenttype parameter in \core\oauth2\rest::call()
2017-08-29 11:18:23 +08:00
bd0b987338 MDL-59855 oauth2: Fix PHPDoc type hints 2017-08-26 15:42:04 +02:00
3fa588c637 MDL-59511 oauth2: Allow empty email in system account 2017-07-28 10:07:25 +02:00
d029841300 MDL-59539 oauth2/issuer: Changed baseurl for guessing image URL
The url, which was used for guessing the image, was queried with the
key 'discoveryurl', which is not defined in the context of an issuer.
The baseurl should be sufficient to retrieve the favicon.ico from a
server. That's why the key for was changed from 'discoveryurl' to
'baseurl'.
2017-07-14 11:10:50 +02:00
7f15866006 MDL-58220 oauth2: Use email as default username
And give better error messages.
2017-04-03 13:43:27 +08:00
9165e83831 MDL-58220 unittests: Fix errors found in unittests 2017-04-03 13:43:26 +08:00
99e3c347f9 MDL-58220 oauth2: Minor cleanups
Fixes spotted by Jun in peer review.
2017-04-03 13:43:25 +08:00
eca128bf47 MDL-58220 oauth2: Global enable/disable for issuers. 2017-04-03 13:41:19 +08:00
141ee541ca MDL-58219 repository: Change how controlled links work
Files are copied to the system user as soon as they are uploaded. Write access is then controlled when
serving links to the file.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
72fd103add MDL-58219 cibot: Fixes
Fixes for cibot warnings.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
28dddbc129 MDL-58219 oauth2: Show connected system account info
Show the username and email of the connected system account (if it ever requires refreshing - this will help identity the account
to re-authorise).

Part of MDL-58220
2017-04-03 13:41:18 +08:00
0e59638bdb MDL-58126 googledocs: Re-implement the google docs repo
Use latest REST API (v3) - but avoid the google client libraries
(too big, too much to update, not integrated with auth).

Part of MDL-58220
2017-04-03 13:40:13 +08:00
299112498b MDL-58090 oauth2: Coding style
Part of MDL-58220
2017-04-03 13:40:13 +08:00
931c023468 MDL-58090 oauth2: Add unit tests
Part of MDL-58220
2017-04-03 13:40:13 +08:00
f9f243f93e MDL-58090 oauth2: Complete phpdocs
Part of MDL-58220
2017-04-03 13:40:13 +08:00
dc4b56852a MDL-58090 oauth2: Do not install services by default
Instead provide buttons to quickly create pre-configured
versions of any of the known OAuth 2 services.

Part of MDL-58220
2017-04-03 13:40:12 +08:00
237fd80cd2 MDL-58090 oauth2: API to get a system client
Request an oauth client with an access token retrieved with the stored refresh token from the OAuth issuer.

Part of MDL-58220
2017-04-03 13:39:45 +08:00
ddf65b8c05 MDL-58090 oauth2: Facebook
Add defaults for facebook authentication and drop behaviour field completely.

Part of MDL-58220
2017-04-03 13:39:45 +08:00
485a22fc98 MDL-58090 oauth2: Get rid of behaviour field
OAuth services working fully from config - no more subclasses for each OAuth issuer.

Part of MDL-58220
2017-04-03 13:39:44 +08:00
8445556b4c MDL-58090 oauth2: Move code from subclasses to config
Allow the behaviour of each oauth service to be customised by config instead of
subclasses.

Part of MDL-58220
2017-04-03 13:39:44 +08:00
60237253a2 MDL-58090 oauth2: Store a list of oauth2 services
Build an admin page where OAuth 2 services can be installed and configured.

Part of MDL-58220
2017-04-03 13:39:02 +08:00