diff --git a/.env.example b/.env.example index f968850ba..fcb9ffa39 100644 --- a/.env.example +++ b/.env.example @@ -145,3 +145,5 @@ NOOVO_DEVICE_CURRIKI_ORGANIZATION_ID= NOOVO_FILE_UPLOAD_TOKEN= MAP_DEVICE_LTI_CLIENT_ID= +#true for only vivensity +GCR_ENV_PERMISSION_VIV=true \ No newline at end of file diff --git a/app/Services/GoogleClassroom.php b/app/Services/GoogleClassroom.php index 89f889fc0..71a0951b2 100644 --- a/app/Services/GoogleClassroom.php +++ b/app/Services/GoogleClassroom.php @@ -46,17 +46,30 @@ function __construct($accessTokenStr = null) { $client = new \Google_Client(); $client->setApplicationName(config('google.gapi_application_name')); - $client->setScopes( - [ - \Google_Service_Classroom::CLASSROOM_COURSES_READONLY, - \Google_Service_Classroom::CLASSROOM_COURSES, - \Google_Service_Classroom::CLASSROOM_TOPICS, - \Google_Service_Classroom::CLASSROOM_COURSEWORK_ME, - \Google_Service_Classroom::CLASSROOM_COURSEWORK_STUDENTS, - \Google_Service_Classroom::CLASSROOM_ROSTERS_READONLY, - \Google_Service_Classroom::CLASSROOM_PROFILE_EMAILS, - ] - ); + if (config('google.gcr_env_permission_viv') == true) { + $client->setScopes( + [ + \Google_Service_Classroom::CLASSROOM_COURSES_READONLY, + \Google_Service_Classroom::CLASSROOM_TOPICS, + \Google_Service_Classroom::CLASSROOM_COURSEWORK_ME, + \Google_Service_Classroom::CLASSROOM_COURSEWORK_STUDENTS, + \Google_Service_Classroom::CLASSROOM_ROSTERS_READONLY, + \Google_Service_Classroom::CLASSROOM_PROFILE_EMAILS, + ] + ); + } else { + $client->setScopes( + [ + \Google_Service_Classroom::CLASSROOM_COURSES_READONLY, + \Google_Service_Classroom::CLASSROOM_COURSES, + \Google_Service_Classroom::CLASSROOM_TOPICS, + \Google_Service_Classroom::CLASSROOM_COURSEWORK_ME, + \Google_Service_Classroom::CLASSROOM_COURSEWORK_STUDENTS, + \Google_Service_Classroom::CLASSROOM_ROSTERS_READONLY, + \Google_Service_Classroom::CLASSROOM_PROFILE_EMAILS, + ] + ); + } $credentials = config('google.gapi_class_credentials'); $client->setAuthConfig(json_decode($credentials, true)); diff --git a/config/google.php b/config/google.php index 73738ad09..0692cf582 100644 --- a/config/google.php +++ b/config/google.php @@ -5,4 +5,5 @@ 'google-recaptcha-secret' => env('GOOGLE_RECAPTCHA_SECRET'), 'gapi_application_name' => env('GAPI_APPLICATION_NAME', 'Curriki Studio Classroom'), 'gapi_client_id' => env('GAPI_CLIENT_ID'), + 'gcr_env_permission_viv' => env('GCR_ENV_PERMISSION_VIV'), ];