does anyone has an idea how to delete role for rules from code?
I am able to turn each rule's expression into BooleanExpression, but i could not figure out how to remove a role from it. Seems like it is a complicate task to do.
You can use the
Fluent Configuration API to modify the Rule Expression itself at runtime. Here is a sample code snippet:
var source = new FileConfigurationSource(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
ConfigurationSourceBuilder configBuilder = new ConfigurationSourceBuilder();
SecuritySettings securityConfigSection = (SecuritySettings)source.GetSection("securityConfiguration");
AuthorizationRuleProviderData provider = (AuthorizationRuleProviderData)securityConfigSection.AuthorizationProviders.Get("Authorization Rule Provider");
AuthorizationRuleData myRule = provider.Rules.Get("Authorization Rule");
//Modify the Rule Expression
myRule.Expression = "MyNewExpression";
//Required code to update the EntLib Configuration with settings set above.
var configSource = new DictionaryConfigurationSource();
//Set the Enterprise Library Container for the inner workings of EntLib to use when logging
EnterpriseLibraryContainer.Current = EnterpriseLibraryContainer.CreateDefaultContainer(configSource);
Noel Angelo Bolasoc
Global Technologies and Solutions