Tech Stack:
- Back-End: Custom Single Sign-On (SSO) implemented with ASP.NET Core Web API, Entity Framework Core, and PostgreSQL, responsible for authenticating users.
- Front-End: Vue.js-based web client application.
Requirements:
- User Entity: Design a user entity where each object (row) has customizable permissions.
- Permission Levels: Implement permission controls at the application, module, form, and input levels.
- SSO Permission Management: Upon user login, the SSO should return an array of permissions.
I tried to create the following tables:
Application:
- id
- name
- enName
Module:
- id
- name
- enName
- appId
Form:
- id
- name
- enName
- moduleId
InputField:
- id
- name
- enName
- formId
And have a Permissions table:
- id
- userId
- typeId
- type (string: App/Module/Form or InputField)
- action (char: c/r/u/d)
When a user logs in, we will send an array of permissions to the frontend, which they can filter and use as they wish using the type field.
I also have an idea for synchronizing the IDs of applications, modules, forms, and fields received from the backend. Each of these entities will have two custom HTML attributes, feId and beId, and I suggest the frontend team devise and assign the feIds in the application, then send them to me. I’ll add them as new columns in the Application, Module, Form, and Input tables. When they run their application, they’ll make a request to the API (something like getNomenclatures) to receive data from the Application, Module, Form, and Input tables. Based on the feId, they’ll re-render all beIds with the ones received from the database. This will only be necessary when launching the application for the first time.
But this causes many hardcoding and sync between FE and BE so I don’t like it.
Alex Ivanov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.