NEW Oauth SCOPE for Admin SDK
This commit is contained in:
parent
b35f1e5b25
commit
ee4e209e7c
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -155,6 +156,9 @@ if ($mode == 'setup' && $user->admin)
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
if(!empty($conf->global->OAUTH_GSUITE)){
|
||||
$shortscope .= ',admin_directory_user';
|
||||
}
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
|
||||
@ -116,6 +116,11 @@ class Google extends AbstractService
|
||||
// Android Publisher
|
||||
const SCOPE_ANDROID_PUBLISHER = 'https://www.googleapis.com/auth/androidpublisher';
|
||||
|
||||
|
||||
// Google Gsuite
|
||||
const SCOPE_ADMIN_DIRECTORY_USER = "https://www.googleapis.com/auth/admin.directory.user";
|
||||
const SCOPE_ADMIN_DIRECTORY_CUSTOMER = "https://www.googleapis.com/auth/admin.directory.customer";
|
||||
|
||||
protected $accessType = 'online';
|
||||
|
||||
public function __construct(
|
||||
@ -150,7 +155,7 @@ class Google extends AbstractService
|
||||
}
|
||||
$this->approvalPrompt = $prompt;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user