-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2293a2c
commit 15024fa
Showing
6 changed files
with
73 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15024fa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeCondition intersection
TypeConditions is the feature that allows Signum Framework to have row-level security.
A TypeConditon expresses a condition for a particular type that can be used to override the default access rule (Write / Read / None)
What is new with this change is that when adding a new rule for a type, you can select more than one type condition:
Producing the following result
Benefits
With this change you don't need to hard-code intersection type conditions anymore, since the infrastructure can do it.
In fact, some of the optimizations that before where made at the
System.Linq.Expression
level are now made at theTypeCondition
level, so you need to remove the hard-coded type conditions!.But more important, before this change merging two roles was... optimistic. If worked for the simple cases but in the general case it failed (Fallback=null) making the type completely disallowed for the role.
But thanks to TypeCondition intersections we allows to Merge any arbitrary set or roles.
Example
Imagine for some type we have four type conditions for:
smart
,ugly
,german
andspain
Image we have two roles:
Role A
with the rules:Role B
with the rules:Role A + B
that is the union ofRole A
andRole B
The new merge algorithm explores all the combinations, takes the maximum (for Union) on each case and then infers the new rules.
Sometimes the result is anti-intuitive but hopefully correct.
How to Migrate
1. Export the AuthRules.xml before migration (or from LIVE environment)
2. SQL Migration / Synchronize
In the generated script replace this:
For this:
3. Export the AuthRules and check that is identical.
4. Remove hard-coded intersecton TypeConditions (if any)
Now if you have any TypeCondition that is an hard-coded intersection like:
You have to remove it and synchronize.
Then in the AuthRules replace:
5. Import Auth Rules
and check that the changes make sense
What's next?
Having a solid Role merging algorithm allows many possibilities in role management.
I think having users being restricted to one-role is an important limitation and in some applications could be useful to have multiple Use-case-roles that can be selected for each user, and virtual roles that are created under the covers for each combination of use cases.
Any idea or feedback?
Enjoy!
15024fa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.