Skip to content

Commit

Permalink
PRSD-358: Added Team-PRSDB accounts and updated ReadMe.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminConterioSW committed Oct 15, 2024
1 parent 59b82ec commit ff2faf7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
27 changes: 11 additions & 16 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,24 @@ populate the database with seed data.
When you run the app and try to view pages, you will be prompted to sign in or create a One Login account.

To view most pages, your account will need to have been added to the relevant database (e.g. LandlordUser,
LocalAuthorityUser) for you to be able to see the page.
LocalAuthorityUser) for you to be able to see the page. It checks the database on login (you can step through
`getRolesforSubjectId` in `UserRolesService` to test it), so you will need to log in again to see the change in
permissions (if logging out is not yet implemented, try running in an incognito tab so you are prompted to log in
again).

For local dev, you can add your account by modifying the `data-local.sql` file. Insert an entry into the
`one_login_user` database with a subject_identifier matching your real one login id (see below).
Then you can add entries to any other user database that you need access to (e.g. landlord_user, local_authority_user
with is_manager set to true to see local authority admin pages).

#### Finding your One Login id
One way to find your id is:
* Inject the principle into somewhere like the start page (ExampleStartPageController.kt)
```kotlin
class ExampleStartPageController {
@GetMapping
fun index(
model: Model,
principal: Principal,
): String {
// No need to change the contents
}
}
```
* Run the app in debug mode, add a break point in your index function and load the page
* When you hit the debug point, your one login id should be available in `principal.name`
One way to find your id is to check the `subjectId` in `getRolesForSubjectId` in the `UserRolesService` while you are
logging in.

* Run the app in debug mode, add a break point in `getRolesForSubjectId`
* If you are already logged in it won't hit the breakpoint. Load the app in an incognito tab so that you are prompted
to log in again.
* When you hit the debug point, your one login id should be available in `subjectId`
(it should look like `urn:fdc:gov.uk:2022:string-of-characters`)

If anyone knows a better way to do this please add it here!
12 changes: 9 additions & 3 deletions src/main/resources/data-local.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ VALUES ('urn:fdc:gov.uk:2022:ABCDE', 'Bob T Builder', '[email protected]',
('urn:fdc:gov.uk:2022:FGHIJ', 'Anne Other', '[email protected]', '09/13/24', '09/13/24'),
('urn:fdc:gov.uk:2022:KLMNO', 'Ford Prefect', '[email protected]', '10/07/24', '10/07/24'),
('urn:fdc:gov.uk:2022:PQRST', 'Arthur Dent', '[email protected]', '10/09/24', '10/09/24'),
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', 'Jasmin Conterio', '[email protected]', '10/07/24', '10/07/24');
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', 'Jasmin Conterio', '[email protected]', '10/07/24', '10/07/24'),
('urn:fdc:gov.uk:2022:mGHDySEVfCsvfvc6lVWf6Qt9Dv0ZxPQWKoEzcjnBlUo','PRSDB Landlord', '[email protected]','10/15/24','10/15/24'),
('urn:fdc:gov.uk:2022:n93slCXHsxJ9rU6-AFM0jFIctYQjYf0KN9YVuJT-cao','PRSDB LA Admin', '[email protected]','10/15/24','10/15/24'),
('urn:fdc:gov.uk:2022:cgVX2oJWKHMwzm8Gzx25CSoVXixVS0rw32Sar4Om8vQ','PRSDB La User', '[email protected]', '10/15/24', '10/15/24');

INSERT INTO landlord_user (subject_identifier, phone_number, date_of_birth, created_date, last_modified_date)
VALUES ('urn:fdc:gov.uk:2022:ABCDE', '07712345678', '01/01/00', '09/13/24', '09/13/24'),
('urn:fdc:gov.uk:2022:FGHIJ', '07811111111', '11/23/98', '09/13/24', '09/13/24'),
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', '01223456789','02/01/00','10/09/24', '10/09/24');
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', '01223456789','02/01/00','10/09/24', '10/09/24'),
('urn:fdc:gov.uk:2022:mGHDySEVfCsvfvc6lVWf6Qt9Dv0ZxPQWKoEzcjnBlUo','01223456789','03/05/00','10/15/24', '10/09/24');

INSERT INTO local_authority (name, created_date, last_modified_date)
VALUES ('Betelgeuse','09/13/24', '09/13/24');

INSERT INTO local_authority_user (subject_identifier, is_manager, local_authority_id, created_date, last_modified_date)
VALUES ('urn:fdc:gov.uk:2022:KLMNO',true, 1,'10/07/24', '10/07/24'),
('urn:fdc:gov.uk:2022:PQRST',false, 1,'10/09/24', '10/09/24'),
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI',true,1,'10/09/24', '10/09/24');
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI',true,1,'10/09/24', '10/09/24'),
('urn:fdc:gov.uk:2022:n93slCXHsxJ9rU6-AFM0jFIctYQjYf0KN9YVuJT-cao',true,1,'10/15/24','10/15/24'),
('urn:fdc:gov.uk:2022:cgVX2oJWKHMwzm8Gzx25CSoVXixVS0rw32Sar4Om8vQ',false,1,'10/15/24','10/15/24');

0 comments on commit ff2faf7

Please sign in to comment.