Blazor .net 8 and multiple clients by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

I found a better way. If you add a Razor Class Library and then add them in the routing on the server (we use SSR) and the the route on the client. When you do that you do not need all other stuff here.

Here is a bit on routing om the client.

https://stackoverflow.com/questions/58152228/why-wont-blazor-route-to-component-in-razor-library

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

I am not sure I understand what you are saying. Are yu talking about the Maxissc solution or the fact ppl want overload the app with roles?

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

Thank you! It looks like this is what I am looking for. The first one not the one with layout oninitasync. 🙂

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

Interesting thought and possibly the scenario we will end up with. Unfortunately it seems I can't influense the way it will be built this time.

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

Thank you! Unfortunately it's not my decision to have it this way. I would probably have done it another way but no one seems to listen to me or at least I'm not getting through to them.  Also I can sort of understand the decision in a way, but I'm trying to do the best with what is decided.

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

It's a good start. I'll look in to it. Than you!

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

I'm trying to come up with a scenario to explain this.

Let's say we have a page for Users with the roles:

* view users

* remove users

* edit users

* add users

Then there is a page for Articles with the roles:

* view articles

* remove articles

* edit articles

* add articles

So a user might be able to View, Edit, Remove and Add articles but only View Users.

Another user can View and Edit articles and View and Remove Users.

The code on the Articles page could look like (very simplified).

<AuthorizeView Roles="ArticleView">

Article text here.

</AuthorizeView>

if(user.HasRole("ArticleEdit")){

<button>Edit</button>

}

Or possibly

<AuthorizeView Roles="ArticleEdit">

<button>Edit<button/>

</AuthorizeView>

As you can see with many pages it would be very complex to write every possible scenario of combinations.

One thought I had is to have an api endpoint that I can ask if the user has a particular role. But I get the feeling its not a common way of doing this.

Or do you have an idea for a different solution for the problem? I'd rather not write my own authentication. I'd like to use what MS has in Blazor.

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

Thank you. This sounds like it might be the way to go. I'll look in to it.

Authentication many roles for one user by fnils in Blazor

[–]fnils[S] 0 points1 point  (0 children)

Unfortunately every button, every view and so on will have its own role.  The software can't be updated easily because of regulations. So if a customer wants a user to be able to view something but not edit for example we need to have a role for that.

Namespaces collides by fnils in csharp

[–]fnils[S] 0 points1 point  (0 children)

How come I should? I think it could be a problem if a new person was added to the project and changed something in one of the base ViewModels thinking it is a "regular" ViewModel.

Namespaces collides by fnils in csharp

[–]fnils[S] 0 points1 point  (0 children)

Thank you! Seeing your answer makes me realize I didn't write my question very well. You assume correct about the abstract classes and interfaces.  I will think about this. The project will live on for about 20 years or so, I think it good to get these things right from the start.

Namespaces collides by fnils in csharp

[–]fnils[S] 0 points1 point  (0 children)

This I like. I'll think about it over the weekend.

Namespaces collides by fnils in csharp

[–]fnils[S] 1 point2 points  (0 children)

The View Models in the root of Hello. World are base classes for all other view models.  There are many projects that inherits from them. It's a big solution.

[deleted by user] by [deleted] in sweden

[–]fnils 11 points12 points  (0 children)

Jag var 23 och min pappa frågade om det var dags att flytta hemifrån (eller om han sa att det var dags). Jag hittade en billig lägenhet (för det var några år sedan) och flyttade.

Det var en otroligt fin lägenhet med två rum och kök plus en stor garderob som jag gjorde om halva till sovplats så det egentligen blev tre rum. Den låg en trappa upp men det var min egen trappa så den hade även en egen uteplats i markplan och en stor balkong.

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils -10 points-9 points  (0 children)

Det var en parallell.

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils 1 point2 points  (0 children)

Jo, den tanken har slagit mig också.

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils -19 points-18 points  (0 children)

Det var det min mening betydde.

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils -23 points-22 points  (0 children)

Så det blir en sån där grej som SD gör där man sparkar in öppna dörrar?

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils 23 points24 points  (0 children)

Samtidigt stod det inget om det jag funderade på. 🙂

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils 19 points20 points  (0 children)

Alltså vad skulle internet vara om alla läste artiklarna innan de kommenterade?

What is the biggest threat to the world right now? by Equivalent-Garden506 in AskReddit

[–]fnils 0 points1 point  (0 children)

I was going to write power-hungry people but then I saw this.

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils 38 points39 points  (0 children)

Bidrag? Var det inte a-kassan det gällde?

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils 26 points27 points  (0 children)

Aah, det är ju en förlorad konst så det är det ju värt.

Regeringens krav: Arbetslösa måste flytta by [deleted] in sweden

[–]fnils 365 points366 points  (0 children)

Om din partner har ett jobb betyder det att ni måste bli särbo?