Previous Content Next
Architecture Design and test business data

Design and test user category

User category means a group of users which match certain rules. Unlike RBAC model and others, ralasafe don't assign users to a group statically. If a user matches the rule of user category, we say the user belongs to this user category.

Example: head office user category's rule is: user's companyLevel field value equals to 1. So Alexis Stark's companyLevel is 1, he belongs to this use category. John Smith' companyLevel is 2, which means he doesn't belong to this user category.

User category's rule can do comparison(in, >, <, >=, !=, is null, is not null, etc), calculation, and expression group operations. And rules can extract data from user, context, database query, or a fixed value.

The GUI contains four parts:

  1. User category tree panel. You can add, delete, update user categories;
  2. Variable definition panel, define variables used in this category;
  3. Expression or expression group definition panel;
  4. When you click "Simulate", simulate panel will be shown.

Design

Take "HQ Users" user category for example, which means user's companyLevel value must be integer 1. We create two variables:

Steps Screen show
1, Simple value, integer 1. Click add button, then select "Simple Value"     
2, User value, engine will read user's property 'companyLevel'. Click add button and select "User Property".     

Then there are two ways to define expression:

Ways Screen show
1, Designing. Right click "Expression Group(AND)", select "New Binary Expression";     

2, Or writing the rule. It' very useful, when the rule is too complicated to design. In this way, you can use variables defined, and call your own java business code.

Click input mode button which is beside save icon.

    

Using expression group for complex expression. There are two linker types for group: AND/OR.

Copy

When two user categories are very similar, you can copy it and make small changes instead of designing it from scratch.

We have designed "HQ Users". Now we can design "Branch Users" by copying "HQ Users", and change HQCompanyLevle to BranchCompanyLevel, and change its value to 2. Very easy, very fast.

Test

When designing work is finished, we can test(simulate) it online immediately. This is a sample simulation screen:

It contains three parts:

  1. Rule panel: shows script of this user category;
  2. Select user panel: click find button, select a user from pop-up user list window;
  3. Test result panel: once click the green run button, ralasafe engine will evaluate this user category ---- to see whether the selected user is matched or not. (If not matched, result will be shown in red)
Previous Content Next
Architecture Design and test business data