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

add access specifier to routes, update validator #118

Merged

Conversation

YashKumarVerma
Copy link
Contributor

@YashKumarVerma YashKumarVerma commented Jul 4, 2021

Summary

  • to clearly map user types/roles to resources, a new property is added to each of the route entries.
  • this entry is used to uniquely identify the resource so that further application logic can be implemented.

Flow

https://i.imgur.com/OHwjDDE.png

  • by adding a new property which specify the resource (i.e. /slide) and the operation on it (i.e. /create, /delete ...)
{
   "route": "/data/Template/post",
   "method": "post",
   "access": {
     "entity": "template",
     "operation": "create"
   },
   "handlers": []
 }

Note : the following json document of resource:operation mapping is for debugging and summary purposes and is generated via /service/routes/entityAndOperations.js

{
  "middleware": [
    "loader.login",
    "loader.slide.delete",
    "loader.proxyHandler",
    "googleAuth",
    "img.iip.raw",
    "data"
  ],
  "slide": ["read", "create", "delete", "update"],
  "request": ["read", "create", "delete"],
  "mark": [
    "read",
    "create",
    "delete",
    "update",
    "types",
    "multi",
    "spatial",
    "findMarkTypes"
  ],
  "presetLabel": ["create", "update", "delete"],
  "template": ["read", "create", "delete", "update"],
  "heatmap": ["read", "types", "create", "delete", "update"],
  "heatmapEdit": ["read", "create", "delete", "update"],
  "log": ["read", "create", "delete", "update"],
  "freeform": ["read", "create", "delete", "update"],
  "configuration": ["read", "create", "delete", "update"],
  "collection": ["read", "create", "update", "delete"],
  "user": ["read", "create", "delete", "update", "wcido"],
  "workbench": [
    "uploadDataset",
    "trainModel",
    "deleteUserData",
    "modelDownload"
  ]
}

This Pull Request

@YashKumarVerma YashKumarVerma changed the title feat(route): add access property, update validator add access specifier to routes, update validator Jul 4, 2021
- add properties to each route entry in routes.json
- update validator to check routes.json for new format
- enforce access_specifier via validator to ensure error free config
@YashKumarVerma
Copy link
Contributor Author

@birm

Copy link
Member

@birm birm left a comment

Choose a reason for hiding this comment

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

Sorry about the delay!

@birm birm merged commit 80e9ab4 into camicroscope:develop Jul 22, 2021
This was referenced Aug 5, 2021
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