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

Only allow CI/CH within the DPY-MAS axis in LMR when the user have railway_undertaker role #10112

Merged
merged 4 commits into from
Jan 9, 2025

Conversation

kmer2016
Copy link
Contributor

@kmer2016 kmer2016 commented Dec 17, 2024

close #9582

To properly test the feature, follow these steps:

Objective

  1. Log in with a railway_undertaker (Stdcm) profile and verify that the Origin/Destination fields only suggest OPs on the DPY-MAS axis.
  2. Log in as a superuser and confirm that you can search for any OP, including those outside the DPY-MAS axis.

Steps to Switch User Profiles

  1. Enable Authorization in Editoast:
    Add the following environment variable to the docker-compose.yml file under OSRD_MQ_URL:

    EDITOAST_DISABLE_AUTHORIZATION: "false"
  2. Rebuild the Docker Image:
    Rebuild the Editoast Docker image and restart the service.

  3. Apply SQL Scripts to Set User Profiles:

    • Railway Undertaking (Stdcm) Profile:
      Run the following SQL script to set up the railway undertaking profile:

      DELETE FROM authz_role WHERE subject = 1;
      INSERT INTO authz_role (id, subject, role) VALUES 
      (1, 1, 'Stdcm'),
      (2, 1, 'RollingStockCollectionRead'),
      (3, 1, 'WorkScheduleRead'),
      (4, 1, 'InfraRead'),
      (5, 1, 'DocumentRead'),
      (6, 1, 'MapRead'),
      (7, 1, 'TimetableRead');
    • Superuser Profile:
      To switch to the superuser profile, simply remove the EDITOAST_DISABLE_AUTHORIZATION: "false" line from the docker-compose.yml file and rebuild the Editoast container.

  4. Validate the Behavior:

    • As a railway_undertaker user, confirm that only DPY-MAS OPs are suggested.
    • As a superuser, confirm that all OPs, including those outside DPY-MAS, are accessible.

@kmer2016 kmer2016 requested a review from a team as a code owner December 17, 2024 15:15
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Dec 17, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.51%. Comparing base (3613a9b) to head (556db2a).
Report is 41 commits behind head on dev.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10112      +/-   ##
==========================================
+ Coverage   81.44%   81.51%   +0.06%     
==========================================
  Files        1058     1059       +1     
  Lines      104286   104596     +310     
  Branches      722      722              
==========================================
+ Hits        84940    85257     +317     
+ Misses      19305    19298       -7     
  Partials       41       41              
Flag Coverage Δ
editoast 73.57% <ø> (-0.05%) ⬇️
front 89.26% <100.00%> (+0.08%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 87.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@kmer2016 kmer2016 changed the title Only allow CI/CH within the DPY-MAS axis in LMR Only allow CI/CH within the DPY-MAS axis in LMR when the user have railway_undertaker role Dec 17, 2024
@kmer2016 kmer2016 force-pushed the cnh/keep-cich-on-dpy-mas branch from 9762cfc to 10512cf Compare December 30, 2024 16:25
@kmer2016 kmer2016 force-pushed the cnh/keep-cich-on-dpy-mas branch from 10512cf to 556db2a Compare January 7, 2025 14:24
Copy link
Contributor

@clarani clarani left a comment

Choose a reason for hiding this comment

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

Code LGTM, I just need to test

Copy link
Contributor

@Math-R Math-R left a comment

Choose a reason for hiding this comment

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

LGTM & tested

@SharglutDev SharglutDev enabled auto-merge January 9, 2025 09:49
@SharglutDev SharglutDev added this pull request to the merge queue Jan 9, 2025
Merged via the queue into dev with commit e1ac027 Jan 9, 2025
28 checks passed
@SharglutDev SharglutDev deleted the cnh/keep-cich-on-dpy-mas branch January 9, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only allow CI/CH within the DPY-MAS axis in LMR
5 participants