Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 24 additions & 11 deletions app/Services/GoogleClassroom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions config/google.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
];