Customize "Who can view this page and its child pages" dialogs
I'm trying to determine if it would be possible to modify the "Who can view this page and its child pages" dialogs in Sitefinity, throughout the site (pages, content blocks, forums, etc), to add a set of custom criteria in addition to the roles and users selection that is built in. Is there a place in the SDK I could make this modification, or are the methods for determining what content is visible to a user inaccessible in some Sitefinity dll?
Hi Matt,
Thank you for using our services.
Actually, the permissions you're referring to are configured through a public control, calle ItemActionPermissionsList. Since permissions in this control are set by calling the Permissions service, the only way you can add additional logic to it would be by mapping the template of this control, adding your own control to the markup (for example a textbox) and in the code-behind execute your own logic. You can use the permissions API from our documentation:
www.sitefinity.com/.../permissions
I'm attaching the default template to this reply. To map it through Sitefinity go to Administration -> Settings -> Advanced -> Viewmap and create a new Viewmap instance wiht the following details:
HostType:Telerik.Sitefinity.Web.UI.Backend.Security.Permissions.ItemActionPermissionsList
layoutTemplatepath: ~/RelativePathToTemplate.ascx
Hope this helps!
Thanks! In the permissions API documentation, it says the principal ID can be the ID of a user or a role. I'm trying to determine if we could develop a customization to grant permissions based on a different custom table (not a role or specific user).
I think I understand from your reply and the sample code how I could modify the dialog to allow the administrator to select these custom permissions, but how would we go about enforcing them when a user is browsing the CMS?
Hi Matt,
Can you provide us with an example on what you want to achieve with the custom permissions? If you're setting permissions to pages by some custom condition, what will it be related to, if not to roles and users?
Greetings,We would like to base the permissions on organizations the user belongs to. The organizations and member management would be based on custom tables. Is there someplace we could hook into the process that determines if a user has permission to view a given piece of content and insert logic to check their membership in these organizations?
Hi Matt,
Since this involves modifying core functionality I would suggest you to set roles to your users, depending on their membership. This can be done by code again. You can query the information from the custom tables and depending on it set a role to a user (if he/she belongs to some membership). Here's the role API:
www.sitefinity.com/.../roles