-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#22 - Add permission handling #24
Conversation
app/Services/PermissionService.php
Outdated
|
||
if ($response->json("installations") !== null) { | ||
foreach ($response->json("installations") as $installation) { | ||
if ($installation["app_id"] === intval(env("GITHUB_APP_ID"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move env
value into config, config can be cached.
app/Services/PermissionService.php
Outdated
{ | ||
public function checkPermissions(): bool | ||
{ | ||
$permissions_given = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$permissions_given = false; | |
$permissionsGiven = false; |
app/Services/PermissionService.php
Outdated
|
||
class PermissionService | ||
{ | ||
public function checkPermissions(): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function checkPermissions(): bool | |
public function checkGitHubAppInstallation(): bool |
More described what that function do.
@@ -21,5 +21,6 @@ | |||
"client_id" => env("GITHUB_CLIENT_ID"), | |||
"client_secret" => env("GITHUB_CLIENT_SECRET"), | |||
"redirect" => env("GITHUB_REDIRECT_URL"), | |||
"app_id" => 918356, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"app_id" => 918356, | |
"app_id" => env("GITHUB_APP_ID"), |
This should close #22
Added permission service that checks if user gave permissions for the application
Added middleware that can be used on routes that need permissions