Skip to content

SMQ-2632 - Separate PAT logic in middleware #2636

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

nyagamunene
Copy link
Contributor

What type of PR is this?

This is a refactor because it seperates PATs logic from Authz middleware

What does this do?

It seperates PATs logic from Authz middleware for users and clients

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Yes

Did you document any new/modified feature?

No

Notes

@nyagamunene nyagamunene changed the title MG-2632 - Separate middleware for PAT logic MG-2632 - Separate PAT logic in middleware Jan 8, 2025
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 1272 lines in your changes missing coverage. Please review.

Project coverage is 34.40%. Comparing base (e7032a6) to head (d0c2318).

Files with missing lines Patch % Lines
groups/middleware/pat.go 0.00% 397 Missing ⚠️
channels/middleware/pat.go 0.00% 393 Missing ⚠️
clients/middleware/pat.go 0.00% 373 Missing ⚠️
users/middleware/pat.go 0.00% 108 Missing ⚠️
clients/middleware/authorization.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2636      +/-   ##
==========================================
- Coverage   42.32%   34.40%   -7.93%     
==========================================
  Files         350      243     -107     
  Lines       47867    40108    -7759     
==========================================
- Hits        20259    13798    -6461     
+ Misses      25402    25219     -183     
+ Partials     2206     1091    -1115     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dborovcanin
Copy link
Collaborator

@arvindh123 Please review this one.

Copy link
Collaborator

@dborovcanin dborovcanin left a comment

Choose a reason for hiding this comment

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

@nyagamunene Please resolve conflicts.

@nyagamunene nyagamunene self-assigned this Jan 15, 2025
@nyagamunene nyagamunene changed the title MG-2632 - Separate PAT logic in middleware SMQ-2632 - Separate PAT logic in middleware Jan 24, 2025
@nyagamunene nyagamunene requested a review from a team as a code owner January 27, 2025 09:21
@nyagamunene nyagamunene force-pushed the MG-2632 branch 2 times, most recently from 8eb9581 to 4ae49e8 Compare January 27, 2025 10:39
@nyagamunene nyagamunene force-pushed the MG-2632 branch 3 times, most recently from 3d4f6e6 to 816a0e3 Compare February 13, 2025 08:37
Copy link
Contributor

@arvindh123 arvindh123 left a comment

Choose a reason for hiding this comment

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

We can merge this PR after merging of #2680

@nyagamunene nyagamunene force-pushed the MG-2632 branch 2 times, most recently from acf54d5 to e1f6026 Compare February 28, 2025 09:56
Copy link
Collaborator

@dborovcanin dborovcanin left a comment

Choose a reason for hiding this comment

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

@nyagamunene What's the status with this one? Please rebase it.

@nyagamunene
Copy link
Contributor Author

@nyagamunene What's the status with this one? Please rebase it.

@dborovcanin This is ready I have rebased it.

Comment on lines 104 to 105
if err := am.checkSuperAdmin(ctx, session.UserID); err != nil {
return clients.ClientsPage{}, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert the logic here, superadmins and non superadmins can list clients, just set the SuperAdmin boolean

@@ -195,6 +196,15 @@ func main() {
defer authzClient.Close()
logger.Info("AuthZ successfully connected to auth gRPC server " + authzClient.Secure())

pat, patHandler, err := authsvcPat.NewAuthorization(ctx, grpcCfg)
if err != nil {
logger.Error("failed to create authz " + err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

could you make this more decriptive to pats authz

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Copy link
Contributor

@arvindh123 arvindh123 left a comment

Choose a reason for hiding this comment

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

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.

Feature: Separate middleware for PAT logics
4 participants