Coalesce icon indicating copy to clipboard operation
Coalesce copied to clipboard

Vue: Add a standard endpoint for retrieving information about the current user

Open ascott18 opened this issue 5 years ago • 1 comments

On the Knockout stack, .cshtml files can be used to dynamically build up pages based on the current logged in user and their permissions and roles.

For the Vue stack, there are no .cshtml files. This information must be pulled back from an API. Because this is a common need for all apps built on the Vue stack, we should probably build this into Coalesce.

Requirements:

  • Create an endpoint that returns:
    • Current logged in user's display name and ID
    • Effective access levels for all Coalesce-exposed types. Read/Create/Edit/Delete.
  • Return type from this endpoint must be extensible so additional application-specific information can be added as needed.
  • Endpoint should be automatically invoked on app boot.
  • Endpoint should be easily refreshable.
  • Should be able to also provide user's current roles, but this maybe shouldn't be enabled by default (could be undesirable to expose such app internals).
  • Data from endpoint should be easily accessible in templates (i.e. put it on Vue.prototype) in a pleasantly-consumable. Some ideas:
    • $canRead('TypeName'), $canEdit, create, delete
    • $user.displayName
    • $user.id
    • $user.roles
    • $isInRole('RoleName')

ascott18 avatar Feb 13 '20 19:02 ascott18

cc @GrantErickson

ascott18 avatar Feb 13 '20 19:02 ascott18