Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

orlowski11
Copy link
Contributor

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

@orlowski11 orlowski11 requested a review from kamilpiech97 June 12, 2024 09:11
@orlowski11 orlowski11 marked this pull request as draft June 12, 2024 12:37

if ($response->json("installations") !== null) {
foreach ($response->json("installations") as $installation) {
if ($installation["app_id"] === intval(env("GITHUB_APP_ID"))) {
Copy link
Member

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.

{
public function checkPermissions(): bool
{
$permissions_given = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$permissions_given = false;
$permissionsGiven = false;


class PermissionService
{
public function checkPermissions(): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function checkPermissions(): bool
public function checkGitHubAppInstallation(): bool

More described what that function do.

@orlowski11 orlowski11 marked this pull request as ready for review June 13, 2024 08:25
@orlowski11 orlowski11 requested a review from kamilpiech97 June 13, 2024 08:26
@@ -21,5 +21,6 @@
"client_id" => env("GITHUB_CLIENT_ID"),
"client_secret" => env("GITHUB_CLIENT_SECRET"),
"redirect" => env("GITHUB_REDIRECT_URL"),
"app_id" => 918356,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"app_id" => 918356,
"app_id" => env("GITHUB_APP_ID"),

@orlowski11 orlowski11 closed this Jun 13, 2024
@orlowski11 orlowski11 deleted the #22-add-permission-handling branch June 13, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add permission handling
2 participants