Skip to content

Commit

Permalink
Added support for Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
PrasadChinwal committed Mar 19, 2024
1 parent d466b34 commit ac170fd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
}
],
"require": {
"illuminate/support": "^9.0|^10.0",
"illuminate/filesystem": "^9.0|^10.0",
"illuminate/support": "^9.0|^10.0|^11.0",
"illuminate/filesystem": "^9.0|^10.0|^11.0",
"laravel/socialite": "^5.10"
},
"require-dev": {
Expand Down
5 changes: 2 additions & 3 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ function safeUnlink(string $filename)
exit(1);
}

$file = app_path() . "/Http/Kernel.php";
$file = app_path().'/Http/Kernel.php';
replace_in_file($file, [
'\App\Http\Middleware\CheckSession::class,' => ""
'\App\Http\Middleware\CheckSession::class,' => '',
]);


confirm('Execute `composer install` and run tests?') && run('composer install && composer test');

confirm('Let this script delete itself?', true) && unlink(__FILE__);
8 changes: 4 additions & 4 deletions migrations/2023_11_14_000000_update_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if(!Schema::hasColumn('users', 'netid')) {
if (! Schema::hasColumn('users', 'netid')) {
$table->string('netid')->after('id');
}

if(!Schema::hasColumn('users', 'first_name')) {
if (! Schema::hasColumn('users', 'first_name')) {
$table->string('first_name')->after('name');
}
if(!Schema::hasColumn('users', 'last_name')) {
if (! Schema::hasColumn('users', 'last_name')) {
$table->string('last_name')->after('first_name');
}
if(!Schema::hasColumn('users', 'uin')) {
if (! Schema::hasColumn('users', 'uin')) {
$table->string('uin', 9)->after('netid')->unique();
}

Expand Down
6 changes: 0 additions & 6 deletions migrations/2023_11_14_000001_update_netid_and_name.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,11 @@ public function down(): void
});
}

/**
* @return bool
*/
protected function updateNetid(): bool
{
return DB::connection()->statement('UPDATE `users` SET `netid` = `name`');
}

/**
* @return bool
*/
protected function updateName(): bool
{
return DB::connection()->statement('UPDATE `users` SET `name` = CONCAT(`first_name`, " ", `last_name`)');
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/AddOidcHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class AddOidcHeader
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
Expand All @@ -22,6 +21,7 @@ public function handle(Request $request, Closure $next)
$response->headers->set('X-Username', $user->email);
$_SERVER['X-Username'] = $user->email;
}

return $response;
}
}
4 changes: 1 addition & 3 deletions src/Oidc/ShibbolethOidcProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ public function user()

/**
* Map Api response data to a User Object.
* @param array $user
* @return User
*/
protected function mapUserToObject(array $user): User
{
Expand All @@ -198,7 +196,7 @@ protected function mapUserToObject(array $user): User
'name' => $user['given_name'].' '.$user['family_name'],
'email' => $user['email'],
'password' => Hash::make($user['uisedu_uin'].now()),
'groups' => array_key_exists('uisedu_is_member_of', $user) ? $user['uisedu_is_member_of']: []
'groups' => array_key_exists('uisedu_is_member_of', $user) ? $user['uisedu_is_member_of'] : [],
]);
}

Expand Down

0 comments on commit ac170fd

Please sign in to comment.