glance icon indicating copy to clipboard operation
glance copied to clipboard

feat: Per-page user access control feature

Open abhi-singhs opened this issue 2 months ago • 1 comments

Solves https://github.com/glanceapp/glance/issues/694 and https://github.com/glanceapp/glance/issues/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:
    - ....

abhi-singhs avatar Nov 02 '25 18:11 abhi-singhs

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

junglebells avatar Nov 03 '25 16:11 junglebells

Would love to see this implemented, I have a few users who want a custom dashboard and this would allow me to do that for them!

MrNavaStar avatar Dec 16 '25 18:12 MrNavaStar