C
C#12mo ago
Henkypenky

❔ Best place to store a flag globally on ASP.NET Core

Hello everyone. What I'm trying to achieve is given a list of users that each have access to 1...N companies, store a flag app wide (for that current user scope) to determine which is the selected company that they will be performing actions for. So far I tried using claims and it kinda works but I know they are not supposed to be used for that. So anyways, if anyone can think of an alternative it would be great. Not looking for a full blown solution, just another mind to tackle the problem. Here is a diagram to illustrate the problem better. Thanks in advance Blazor Server .NET 7
8 Replies
Henkypenky
Henkypenky12mo ago
another idea i found while googling is to have a singleton service that carries that information everything can be loaded on app startup and there is no need to modify stuff while running, we can just restart for this scenarios
ffmpeg -i me -f null -
what do you mean my "not looking for a full blown solution", i mean it depends what you will do with this flag to me the obvious would be a relation between user and company, but i don't know if you are using a db or for example if this 'flag' has to be part of migrations, if it has to be available in various redundant services, if it has to be part of data backups, if it can be read/written, and so on
Henkypenky
Henkypenky12mo ago
there is no db, everything runs on http requests between the app and a service layer with support of a key vault for secrets
sliceofbytes
sliceofbytes12mo ago
Use a cascading aparam Or like you said a singleton with a constructor param to configure the singleton
Henkypenky
Henkypenky12mo ago
that might work
ffmpeg -i me -f null -
so do you use this like a sort of permission? like RBAC?
Henkypenky
Henkypenky12mo ago
this already comes filtered from the db, it's more like a filter to separate company operations, there will be roles configured from azure aswell this works perfectly, thanks
<CascadingValue Value="@Whatever">
@Body
</CascadingValue>
<CascadingValue Value="@Whatever">
@Body
</CascadingValue>
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts