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

feat(users): Added get role from jwt api #3385

Merged
merged 5 commits into from
Jan 18, 2024
Merged

Conversation

racnan
Copy link
Contributor

@racnan racnan commented Jan 18, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Added API to get list of permission user has.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Required for hyperswitch control centre

How did you test it?

curl --location --request GET '<URL>/user/role' \
--header 'Authorization: Bearer <JWT>'

Above API should give an array of permission.
All roles and their permission can be found here.

Example response,

[
    "PaymentRead",
    "RefundRead",
    "ApiKeyRead",
    "MerchantAccountRead",
    "MerchantConnectorAccountRead",
    "RoutingRead",
    "ForexRead",
    "ThreeDsDecisionManagerRead",
    "SurchargeDecisionManagerRead",
    "Analytics",
    "DisputeRead",
    "MandateRead",
    "CustomerRead",
    "FileRead",
    "UsersRead"
]

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@racnan racnan requested review from a team as code owners January 18, 2024 10:53
@racnan racnan requested review from ThisIsMani and removed request for ThisIsMani January 18, 2024 10:53
@racnan racnan self-assigned this Jan 18, 2024
@racnan racnan added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-users Area: Users labels Jan 18, 2024
@racnan racnan linked an issue Jan 18, 2024 that may be closed by this pull request
apoorvdixit88
apoorvdixit88 previously approved these changes Jan 18, 2024
apoorvdixit88
apoorvdixit88 previously approved these changes Jan 18, 2024
ThisIsMani
ThisIsMani previously approved these changes Jan 18, 2024
Narayanbhat166
Narayanbhat166 previously approved these changes Jan 18, 2024
impl TryFrom<&Permission> for user_role_api::Permission {
type Error = ();
fn try_from(value: &Permission) -> Result<Self, Self::Error> {
impl From<&Permission> for user_role_api::Permission {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to implement conversion on &T instead of T?

@racnan racnan requested a review from vspecky January 18, 2024 13:44
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 18, 2024
Merged via the queue into main with commit 7516a16 Jan 18, 2024
9 checks passed
@likhinbopanna likhinbopanna deleted the get-role-from-jwt branch January 18, 2024 15:02
pixincreate added a commit that referenced this pull request Jan 18, 2024
* 'main' of github.com:juspay/hyperswitch:
  feat(users): Added get role from jwt api (#3385)
  feat(users): Add `preferred_merchant_id` column and update user details API (#3373)
  chore(version): 2024.01.18.1
  refactor(core): add locker config to enable or disable locker  (#3352)
  fix(connector): [Cashtocode] update amount from i64 to f64 in webhook payload (#3382)
  fix(metrics): Add TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics in router scheduler flow (#3189)
  fix(connector): Trustpay zen error mapping (#3255)
  fix(user): fetch profile_id for sample data (#3358)
  refactor(connector): [Volt] Refactor Payments and Refunds Webhooks (#3377)
  chore(version): 2024.01.18.0
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: get user role from token
7 participants