The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
We have talked about the building parts: security roots and permissions. Now it is time to explain how to bind the two things together, and, in the process, let Sitefinity know that your module will use security.
First of all, the module should implement SecuredModule, instead of WebModule.Here is how the sample Contacts pluggable module is declared:
public class ContactsModule : SecuredModule |
In a secured module, we have to override two more properties
/// <summary> |
/// Gets the security root. |
/// </summary> |
/// <value>The security root.</value> |
public override Telerik.Security.Permissions.ISecured SecurityRoot |
{ |
get |
{ |
return this.SecurityRoots[Configuration.ConfigHelper.Handler.DefaultProvider]; |
} |
} |
/// <summary> |
/// Gets the security roots. |
/// </summary> |
/// <value>The security roots.</value> |
public override IDictionary<string, ISecured> SecurityRoots |
{ |
get |
{ |
return ContactsManager.SecurityRoots; |
} |
} |
The careful reader has already noticed a contradiction: that the provider is not directly connected to a security root. However, if we look at the code for ContactsManager.Security roots:
/// <summary> |
/// Gets the security roots. |
/// </summary> |
/// <value>The security roots.</value> |
public static Dictionary<String, ISecured> SecurityRoots |
{ |
get |
{ |
if (securityRoots == null) |
{ |
securityRoots = new Dictionary<String, ISecured>(ContactsManager.Providers.Count); |
foreach (string name in ContactsManager.Providers.Keys) |
securityRoots.Add(name, new GlobalPermissions(name)); |
} |
return securityRoots; |
} |
} |
we will see that this is implemented in the manager, and the provider is still not directly connected with a security root. This implementation gives us yet another example that there is an association, but not direct connection.
Here are some more helper (but not required) methods and properties in the ContactsManager that are related to security:
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.