11
Views
2
Comments
Solved
Reactive Web Aggregates with Roles
Hello everyone,

I am using reactive web and I have a use case that I want to make sure I am implementing properly. So, I am creating a queue using weblock that will essentially populate that queue information according to the users role. For example, I have a Customer, District, Regional and Corporate roles. So basically when each individual role accesses this site, the queue is filtered with the information per that role I.e. the customer will see they’re personal application status, the district will see all customers in the  districts they belong to.... all the way to the top where corporate has ability to view all customers in districts and regions.

The way I plan to achieve this is to essentially have a aggregate for each and every role. When the user with the role logs in to the website, there will be an on after Fetch action that will check the user’s role and  populate the appropriate  aggregate only.

I believe that this will be at the best way to filter this information without bringing back unnecccssy data, although I may have to contend with say another role that may already say updated or executed on the customer information but maybe I can implement some logic that will be displayed back informing the user of this change say with the last 30 seconds  and if they would like to override it or cancel.

Any thoughts?


mvp_badge
MVP
Rank: #17
Solution

Hi,

Why not leverage the systems entity UserRole Id attribute? Add this as a foreign key to your queue entity.

You can get the UserRole.Id via an aggregate with a join between User, Role and UserRole, with an filter on User.Id  and Role.Name.

That way you only need one aggregate, independent of the number of roles you define.

Regards,

Daniel


Rank: #942

Thanks!!!!!!! Makes sense, will do!