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

Mui admin app auth #134

Merged
merged 4 commits into from
Mar 20, 2024
Merged

Mui admin app auth #134

merged 4 commits into from
Mar 20, 2024

Conversation

sidravi1
Copy link
Member

@sidravi1 sidravi1 commented Mar 19, 2024

Reviewer: @amiraliemami
Estimate: 2 hrs


Ticket

Fixes: 408

Description, Motivation and Context

Goal

Setup auth/access controls for new MUI Admin app

Changes

new AuthProvider component
new login screen
components disabled if "readonly"

How has this been tested?

Only through the UI.

Checklist

Fill with x for completed. Delete any lines that are not relevant

  • My code follows the style guidelines of this project
  • I have reviewed my own code to ensure good quality
  • I have tested the functionality of my code to ensure it works as intended
  • I have resolved merge conflicts
  • I have updated the automated tests (if applicable)
  • I have updated the requirements (if applicable)
  • I have updated the README file (if applicable)
  • I have updated affected documentation (if applicable)

admin_app_2/package.json Show resolved Hide resolved
admin_app_2/src/app/content/edit/page.tsx Show resolved Hide resolved
admin_app_2/src/app/content/layout.tsx Show resolved Hide resolved
admin_app_2/src/app/content/page.tsx Outdated Show resolved Hide resolved
admin_app_2/src/app/login/page.tsx Show resolved Hide resolved
admin_app_2/src/components/ContentModal.tsx Show resolved Hide resolved
admin_app_2/src/components/NavBar.tsx Show resolved Hide resolved
admin_app_2/src/utils/api.ts Show resolved Hide resolved
@sidravi1 sidravi1 changed the title Mui auth Mui admin app auth Mar 19, 2024
Copy link
Collaborator

@amiraliemami amiraliemami left a comment

Choose a reason for hiding this comment

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

Thanks for this - learned a lot!

Left some comments - three major things I came across to fix before merge:

  1. Refreshing the page resets the permissions to the default value set in the auth.tsx file (see comment on there).
  2. Edit page's useEffect still runs and fetches content in the background even with just readonly access (see comment).
  3. Edit and New buttons' links still work even on readonly. Suggested fixes.

Thanks!

admin_app_2/src/app/content/page.tsx Outdated Show resolved Hide resolved
admin_app_2/src/components/ContentCard.tsx Outdated Show resolved Hide resolved
admin_app_2/src/utils/auth.tsx Outdated Show resolved Hide resolved
admin_app_2/src/utils/auth.tsx Outdated Show resolved Hide resolved
admin_app_2/src/utils/api.ts Outdated Show resolved Hide resolved
admin_app_2/src/app/content/edit/page.tsx Show resolved Hide resolved
admin_app_2/src/components/ProtectedComponent.tsx Outdated Show resolved Hide resolved
admin_app_2/src/app/login/page.tsx Show resolved Hide resolved
admin_app_2/src/app/content/layout.tsx Outdated Show resolved Hide resolved
admin_app_2/src/utils/auth.tsx Outdated Show resolved Hide resolved
Co-authored-by: Amir Emami <41763233+amiraliemami@users.noreply.github.com>
@amiraliemami amiraliemami self-requested a review March 20, 2024 13:57
Copy link
Collaborator

@amiraliemami amiraliemami left a comment

Choose a reason for hiding this comment

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

Thanks for the responses. Approving to unblock merging for you tonight but two things to fix before merge:

  1. Accept suggestions on button links
  2. Auth state loss on refresh

Thanks!

@sidravi1 sidravi1 merged commit a7cc000 into feature-mui-admin Mar 20, 2024
1 check passed
@sidravi1 sidravi1 deleted the mui-auth branch March 20, 2024 16:00
amiraliemami pushed a commit that referenced this pull request Mar 21, 2024
* sort results by content_id
* Auth and access level
* fixes from review
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* Mui admin app auth (#134)

* sort results by content_id
* Auth and access level
* fixes from review

* HOTFIX: Layout import missing from "ProtectedComponent.tsx"

* MUI improvements + search bar + navbar activation (#131)

* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* address leftover PR#130 comments

* remove unnecessary spacing on cards

* Make page buttons circular and smaller

* cleanup imports

* add max count to title input

* Revert text box identifiers to reflect wireframe

* Cleanup text boxes in Edit

* add date back to cards to reflect wireframe

* date to 12hr format

* add space to bottom of page

* reduce cardgrid density

* change all instances of content_id to number (some where string)

* improve delete button and modal

* use the Content type in main grid

* Add skeleton of search bar

* Implement search functionality!

* remove unnecessary wrapper

* Move SearchBar and PageNavigation to components

* Move sx parameters out of SearchBar component

* Make CardsGrid backdrop persist even without cards on it

* Convert Box to FlexBox and revert to 4-columns of cards on large screens

* NavBar: add homepage link to AAQ logo

* NavBar: enable links (but disable inactive pages)

* NavBar: Make logo and user icon smaller

* Set max cards back to 12

* Use content_id as key instead of index in Grid component

* PR feedback fixes

* cleanup imports

* Simplify editAccess check boolean (use !editAccess)

* Widen gap between date and buttons on cards

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>

* Replace old admin app with new MUI admin app (#136)

* temp - remove old `src`

* temp - replace/remove files

* move logo png to inside admin app

* Add condition for catching missing content_id

* TEMP FIX: Disable missingSuspenseWithCSRBailout error. See Jira ticket 424 for details.

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* Mui admin app auth (#134)

* sort results by content_id
* Auth and access level
* fixes from review

* HOTFIX: Layout import missing from "ProtectedComponent.tsx"

* MUI improvements + search bar + navbar activation (#131)

* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* address leftover PR#130 comments

* remove unnecessary spacing on cards

* Make page buttons circular and smaller

* cleanup imports

* add max count to title input

* Revert text box identifiers to reflect wireframe

* Cleanup text boxes in Edit

* add date back to cards to reflect wireframe

* date to 12hr format

* add space to bottom of page

* reduce cardgrid density

* change all instances of content_id to number (some where string)

* improve delete button and modal

* use the Content type in main grid

* Add skeleton of search bar

* Implement search functionality!

* remove unnecessary wrapper

* Move SearchBar and PageNavigation to components

* Move sx parameters out of SearchBar component

* Make CardsGrid backdrop persist even without cards on it

* Convert Box to FlexBox and revert to 4-columns of cards on large screens

* NavBar: add homepage link to AAQ logo

* NavBar: enable links (but disable inactive pages)

* NavBar: Make logo and user icon smaller

* Set max cards back to 12

* Use content_id as key instead of index in Grid component

* PR feedback fixes

* cleanup imports

* Simplify editAccess check boolean (use !editAccess)

* Widen gap between date and buttons on cards

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>

* Replace old admin app with new MUI admin app (#136)

* temp - remove old `src`

* temp - replace/remove files

* move logo png to inside admin app

* Add condition for catching missing content_id

* TEMP FIX: Disable missingSuspenseWithCSRBailout error. See Jira ticket 424 for details.

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* sort results by content_id
* Auth and access level
* fixes from review
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* Mui admin app auth (#134)

* sort results by content_id
* Auth and access level
* fixes from review

* HOTFIX: Layout import missing from "ProtectedComponent.tsx"

* MUI improvements + search bar + navbar activation (#131)

* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* address leftover PR#130 comments

* remove unnecessary spacing on cards

* Make page buttons circular and smaller

* cleanup imports

* add max count to title input

* Revert text box identifiers to reflect wireframe

* Cleanup text boxes in Edit

* add date back to cards to reflect wireframe

* date to 12hr format

* add space to bottom of page

* reduce cardgrid density

* change all instances of content_id to number (some where string)

* improve delete button and modal

* use the Content type in main grid

* Add skeleton of search bar

* Implement search functionality!

* remove unnecessary wrapper

* Move SearchBar and PageNavigation to components

* Move sx parameters out of SearchBar component

* Make CardsGrid backdrop persist even without cards on it

* Convert Box to FlexBox and revert to 4-columns of cards on large screens

* NavBar: add homepage link to AAQ logo

* NavBar: enable links (but disable inactive pages)

* NavBar: Make logo and user icon smaller

* Set max cards back to 12

* Use content_id as key instead of index in Grid component

* PR feedback fixes

* cleanup imports

* Simplify editAccess check boolean (use !editAccess)

* Widen gap between date and buttons on cards

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>

* Replace old admin app with new MUI admin app (#136)

* temp - remove old `src`

* temp - replace/remove files

* move logo png to inside admin app

* Add condition for catching missing content_id

* TEMP FIX: Disable missingSuspenseWithCSRBailout error. See Jira ticket 424 for details.

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* sort results by content_id
* Auth and access level
* fixes from review
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* Mui admin app auth (#134)

* sort results by content_id
* Auth and access level
* fixes from review

* HOTFIX: Layout import missing from "ProtectedComponent.tsx"

* MUI improvements + search bar + navbar activation (#131)

* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* address leftover PR#130 comments

* remove unnecessary spacing on cards

* Make page buttons circular and smaller

* cleanup imports

* add max count to title input

* Revert text box identifiers to reflect wireframe

* Cleanup text boxes in Edit

* add date back to cards to reflect wireframe

* date to 12hr format

* add space to bottom of page

* reduce cardgrid density

* change all instances of content_id to number (some where string)

* improve delete button and modal

* use the Content type in main grid

* Add skeleton of search bar

* Implement search functionality!

* remove unnecessary wrapper

* Move SearchBar and PageNavigation to components

* Move sx parameters out of SearchBar component

* Make CardsGrid backdrop persist even without cards on it

* Convert Box to FlexBox and revert to 4-columns of cards on large screens

* NavBar: add homepage link to AAQ logo

* NavBar: enable links (but disable inactive pages)

* NavBar: Make logo and user icon smaller

* Set max cards back to 12

* Use content_id as key instead of index in Grid component

* PR feedback fixes

* cleanup imports

* Simplify editAccess check boolean (use !editAccess)

* Widen gap between date and buttons on cards

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>

* Replace old admin app with new MUI admin app (#136)

* temp - remove old `src`

* temp - replace/remove files

* move logo png to inside admin app

* Add condition for catching missing content_id

* TEMP FIX: Disable missingSuspenseWithCSRBailout error. See Jira ticket 424 for details.

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>
lickem22 pushed a commit that referenced this pull request Mar 22, 2024
* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* Mui admin app auth (#134)

* sort results by content_id
* Auth and access level
* fixes from review

* HOTFIX: Layout import missing from "ProtectedComponent.tsx"

* MUI improvements + search bar + navbar activation (#131)

* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* address leftover PR#130 comments

* remove unnecessary spacing on cards

* Make page buttons circular and smaller

* cleanup imports

* add max count to title input

* Revert text box identifiers to reflect wireframe

* Cleanup text boxes in Edit

* add date back to cards to reflect wireframe

* date to 12hr format

* add space to bottom of page

* reduce cardgrid density

* change all instances of content_id to number (some where string)

* improve delete button and modal

* use the Content type in main grid

* Add skeleton of search bar

* Implement search functionality!

* remove unnecessary wrapper

* Move SearchBar and PageNavigation to components

* Move sx parameters out of SearchBar component

* Make CardsGrid backdrop persist even without cards on it

* Convert Box to FlexBox and revert to 4-columns of cards on large screens

* NavBar: add homepage link to AAQ logo

* NavBar: enable links (but disable inactive pages)

* NavBar: Make logo and user icon smaller

* Set max cards back to 12

* Use content_id as key instead of index in Grid component

* PR feedback fixes

* cleanup imports

* Simplify editAccess check boolean (use !editAccess)

* Widen gap between date and buttons on cards

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>

* Replace old admin app with new MUI admin app (#136)

* temp - remove old `src`

* temp - replace/remove files

* move logo png to inside admin app

* Add condition for catching missing content_id

* TEMP FIX: Disable missingSuspenseWithCSRBailout error. See Jira ticket 424 for details.

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>
suzinyou pushed a commit that referenced this pull request Apr 8, 2024
* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* Mui admin app auth (#134)

* sort results by content_id
* Auth and access level
* fixes from review

* HOTFIX: Layout import missing from "ProtectedComponent.tsx"

* MUI improvements + search bar + navbar activation (#131)

* MUI content pages (#130)

Basic content grid
Alerts and Snackbars
Fixed warnings and errors in console
Better modals
Better validation errors

* address leftover PR#130 comments

* remove unnecessary spacing on cards

* Make page buttons circular and smaller

* cleanup imports

* add max count to title input

* Revert text box identifiers to reflect wireframe

* Cleanup text boxes in Edit

* add date back to cards to reflect wireframe

* date to 12hr format

* add space to bottom of page

* reduce cardgrid density

* change all instances of content_id to number (some where string)

* improve delete button and modal

* use the Content type in main grid

* Add skeleton of search bar

* Implement search functionality!

* remove unnecessary wrapper

* Move SearchBar and PageNavigation to components

* Move sx parameters out of SearchBar component

* Make CardsGrid backdrop persist even without cards on it

* Convert Box to FlexBox and revert to 4-columns of cards on large screens

* NavBar: add homepage link to AAQ logo

* NavBar: enable links (but disable inactive pages)

* NavBar: Make logo and user icon smaller

* Set max cards back to 12

* Use content_id as key instead of index in Grid component

* PR feedback fixes

* cleanup imports

* Simplify editAccess check boolean (use !editAccess)

* Widen gap between date and buttons on cards

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>

* Replace old admin app with new MUI admin app (#136)

* temp - remove old `src`

* temp - replace/remove files

* move logo png to inside admin app

* Add condition for catching missing content_id

* TEMP FIX: Disable missingSuspenseWithCSRBailout error. See Jira ticket 424 for details.

---------

Co-authored-by: Sid Ravinutala <sid.ravi1@gmail.com>
lickem22 pushed a commit that referenced this pull request Apr 11, 2024
* sort results by content_id
* Auth and access level
* fixes from review
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.

None yet

2 participants