Two 'READ PROTECT' rules

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
vinsnash
Posts: 415
Joined: Sun Oct 07, 2007 4:58 pm

Two 'READ PROTECT' rules

Post by vinsnash »

1. If NOT(LoggedInRegularUser.Status = 'CO' AND NSCPers.UnitCode = LoggedInRegularUser.LoginName) THEN READ PROTECT NSCPers FROM Guest

2. If NOT(LoggedInRegularUser.Status = 'REG' AND NSCPers.UnitCode STARTSWITH LoggedInRegularUser.Region) READ PROTECT NSCPers FROM Guest

There is a 'RegularUser' instance with attribute Status of 'CO' and LoginName that and numerous instances of NSCPers with attribute UnitCode that matches. #1 works perfectly if LoginName = '054AXV' then RegularUser only sees query results that have the matching UnitCode '054AXV'

There is a 'RegularUser' with attribute 'Region' that is '054' and Status 'REG' and many instances of NCPers with UnitCode = '054XXX' where XXX = some character combination. Guest has 'Full Access' to NSCPers.

Both RegularUser instances use the same 'Access Level' and 'Visual Perspective'

#2 does not work. With RegularUser.LoginName of '054REG' and attribute 'Region' of '054' there are no results to the same query. The only difference I see is the use of 'STARTSWITH'

What am I missing here?

Thanks for the help.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

A couple of ideas for you:

1) Your #2 does not have THEN but #1 does.... maybe a typo?

2) Have you looked at the logs to see what they say when #2 fires?

3) If STARTSWITH does not work for this scenario, try adding a new attribute NSCPers.UnitCodeRegion with a rule that grabs the region out of the UnitCode. NSCPers.UnitCodeRegion could then be used in rule #2 instead of STARTSWITH.
Tom - V8.8 build 3137 - MySql / PostGres
vinsnash
Posts: 415
Joined: Sun Oct 07, 2007 4:58 pm

Post by vinsnash »

Yes, it is a typo.

This is what I see on the log:

Started evaluation of rules after data has been changed by the actions
.
.
.
Checking rule COProtectRule (Rule #1)
Checking rule UnitLevelCodeRule
Action REPORT ERROR 'Invalid Unit Code detected' is not allowed during initialisation.

Rule #2 does not show.

"UnitLevelCodeRule" is meant to default the LoginName as the UnitCode attribute of NSCPers when creating a new instance.

If NSCPers IS NEW AND LoggedInRegularUser.Status='CO' Then
NSCPers.UnitCode=LoggedInRegularUser.LoginName

I haven't launched the create process only logged on with the regular user '054REG' and selected a query to run.

Again is there a way to clear those log entries after each test run?

Thanks for all the help
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Only way to clear the log is to close it out + reopen it.
Tom - V8.8 build 3137 - MySql / PostGres
vinsnash
Posts: 415
Joined: Sun Oct 07, 2007 4:58 pm

Post by vinsnash »

I really don't see an option to 'close out' the log in the logging dialogue. I can view it, there is an 'edit option but other than that the only option I see is to close the view window.

When I do another session and look at the log it is all still there.

Thanks
Post Reply