Skip to main content

Storing unchangableunchangeable data in database vs in code

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser etc. and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. They can do it for all kind of roles. Dynamic roles or "unchangable""unchangeable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangable""unchangeable" data.

  1. Where should I put my "unchangable""unchangeable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangableunchangeable rows in it my dynamic data table.

  2. Where should I put my "unchangable""unchangeable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think, the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangable""unchangeable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (Even for Admin and StandardUser remember they are not dynamic roles.)

Storing unchangable data in database vs in code

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser etc. and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. They can do it for all kind of roles. Dynamic roles or "unchangable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangable" data.

  1. Where should I put my "unchangable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangable rows in it my dynamic data table.

  2. Where should I put my "unchangable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think, the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (Even for Admin and StandardUser remember they are not dynamic roles.)

Storing unchangeable data in database vs in code

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser etc. and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. They can do it for all kind of roles. Dynamic roles or "unchangeable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangeable" data.

  1. Where should I put my "unchangeable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangeable rows in it my dynamic data table.

  2. Where should I put my "unchangeable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think, the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangeable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (Even for Admin and StandardUser remember they are not dynamic roles.)

added 29 characters in body
Source Link

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser etc. and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. For dynamicThey can do it for all kind of roles and. Dynamic roles or "unchangable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangable" data.

  1. Where should I put my "unchangable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangable rows in it my dynamic data table.

  2. Where should I put my "unchangable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think, the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (evenEven for Admin and StandardUser remember they are not dynamic roles.)

Am

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. For dynamic roles and "unchangable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangable" data.

  1. Where should I put my "unchangable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangable rows in it my dynamic data table.

  2. Where should I put my "unchangable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (even for Admin and StandardUser remember they are not dynamic roles)

Am

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser etc. and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. They can do it for all kind of roles. Dynamic roles or "unchangable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangable" data.

  1. Where should I put my "unchangable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangable rows in it my dynamic data table.

  2. Where should I put my "unchangable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think, the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (Even for Admin and StandardUser remember they are not dynamic roles.)

Became Hot Network Question
Source Link

Storing unchangable data in database vs in code

Hi I am trying to create a role based dynamic route authorization system on my NodeJS ExpressJS powered API server.

Scenario:

  • There will be some roles like Admin, StandardUser and they can't be edited or removed.

  • More roles can be added by authorized users dynamically. These roles of course can be edited or removed.

  • Authorized users can set all the route permissions. They can set Role A can use Route X. For dynamic roles and "unchangable" roles like Admin and StandardUser.

Now my scenario shows that I need a Roles Table because of my dynamic roles and a RoutePermissions Table for dynamically assign route access to my roles. However I can't find a way to store my "unchangable" data.

  1. Where should I put my "unchangable" (I don't know if there is a term for it. Please let me know.) role data. Where should I put SuperAdmin and StandardUser roles? Because if I put them in roles table in my DB I will have 2 unchangable rows in it my dynamic data table.

  2. Where should I put my "unchangable" route data. Since the routes (POST /users/deactivate) are coded in the system I don't think it is correct to put them in database. Because I think the database should contain only the dynamic data but my routes are not dynamic.

  3. If i don't put my "unchangable" data to DB. I can store it in my code like enums or consts but how can I dynamically create permissions with them? Because permissions are dynamic for each role. (even for Admin and StandardUser remember they are not dynamic roles)

Am