Skip to content

Conversation

@abhi-singhs
Copy link

Solves #694 and #856.
User-based page access control to the application, allowing pages to specify which users are permitted to view them. It also updates navigation and UI elements to reflect the authenticated user's identity and restricts navigation links to only those pages the user can access.

  • Add functions to retrieve username from request and check page access.
  • Update page struct to include allowed users.
  • Modify template data to include accessible pages for the user.
  • Enhance HTML templates to display logged-in username and restrict access to pages based on user permissions.
  • Introduce new CSS styles for username display in mobile and site views.

Usage:

pages:
  - name: Private
    allowed-users:
      - home
      - work
    columns: ...

Note: This is an optional field. If this property is not added then the page is available to all logged-in users.

Example:
image

image

glance.yml:

server:
  assets-path: /app/assets

auth:
  secret-key: ....
  users:
    home:
      password-hash: ....
    work:
      password-hash: ....

theme:
  custom-css-file: /assets/user.css

pages:
  - $include: home.yml
  - $include: admin.yml
  - $include: work.yml
  - $include: misc.yml

home.yml:

- name: Home
  columns:
    - ....

admin.yml:

- name: Admin
  allowed-users:
    - home
  columns:
    - ....

work.yml:

- name: Work
  allowed-users:
    - work
  columns:
    - ....

misc.yml:

- name: Misc
  allowed-users:
    - home
  columns:
    - ....

- Add functions to retrieve username from request and check page access.
- Update page struct to include allowed users.
- Modify template data to include accessible pages for the user.
- Enhance HTML templates to display logged-in username and restrict access to pages based on user permissions.
- Introduce new CSS styles for username display in mobile and site views.
@junglebells
Copy link

@abhi-singhs - this looks great to me, would love to see it implemented. Thanks for taking it on.

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.

2 participants