25
Views
5
Comments
Solved
Filter aggregate by Role
Question

Hello everyone,

I have a problem that I can't solve. I have a Table Records, which has an Aggregate as Source.

This Table records now presents a list of data and I have different roles to different users how can I retrieve or put a condition if this user has one of my roles it'only shows this data depends on my conditions

to explian more to get the idea I will make an example :

I have two roles x1 and x2 

and both have the same dashboard, how can I get for x1 his data without x2 data ! with same table ?


Thanks for help


mvp_badge
MVP
Rank: #68
Solution

If the form is the same, you have to use the same Entity.

Assuming your Departments are in a Static (they should if you have Roles by department)


You just need a filter of type

(Form.DepartmentId=Entities.Departments.Sales and CheckSalesRole()) or

(Form.DepartmentId=Entities.Departments.Legal and CheckLegalRole())

Each role will only see forms from one department.

Rank: #143

Hello Yousef,

For example, you can use 2 local variables to control if the user has that role or not:
HasRole1 (True if the user has Role1, False otherwise) and HasRole2 (True if the user has Role2, False otherwise)

Then, in your aggregate, you can use these variables in your conditions and do something like:

If ( HasRole1, <Condition1>, True )
If ( HasRole2, <Condition2>, True )

Or something like:

(HasRole1 and <Condition1>) or (HasRole2 and <Condition2>)


Kind regards,

Rui Barradas

mvp_badge
MVP
Rank: #68

Hello Yousef.

You have CheckRole functions. Those can be used on Aggregates.

If you need more help, can you give an example of what you are trying to do?

Rank: #390

Yousef Shraim wrote:

Hello everyone,

I have a problem that I can't solve. I have a Table Records, which has an Aggregate as Source.

This Table records now presents a list of data and I have different roles to different users how can I retrieve or put a condition if this user has one of my roles it'only shows this data depends on my conditions

to explian more to get the idea I will make an example :

I have two roles x1 and x2 

and both have the same dashboard, how can I get for x1 his data without x2 data ! with same table ?


Thanks for help


Hi, 

You can check user role by CheckRoleNameRole() function in action flow. and u can retrieve data according to that role. 

You can get Users List with theirs Role by using these below systems tables.


Hope this may help

Thanks.

mvp_badge
MVP
Rank: #68
Solution

If the form is the same, you have to use the same Entity.

Assuming your Departments are in a Static (they should if you have Roles by department)


You just need a filter of type

(Form.DepartmentId=Entities.Departments.Sales and CheckSalesRole()) or

(Form.DepartmentId=Entities.Departments.Legal and CheckLegalRole())

Each role will only see forms from one department.