Gooddogs Development Blog

Repository Module 3.5.1 Beta, Item Level Security

Feb 13

Written by:
2/13/2011 4:49 PM  RssIcon

One scenario is a customer support type of site. You can establish a security role for each of your clients, then create a ‘Client Downloads’ page. On that page, drop an instance of the Repository module and select the template of your choice. In the ‘form.html’ template file for the template you’ve chosen, add a [SECURITYROLES] token. Now, when you upload a file to that repository instance, you will see a checkbox list of the security roles available on your site, allowing you to upload files and designate which of your clients can see which downloads. Now, all of your clients can access your site, log in, go to the ‘Client Downloads’ page and see only their files.

Example:

Let’s say I want to setup a Client Downloads page like in the previous example. I’ve downloaded and installed the 3.5.1 Repository Beta release (link). I’ve create a new page, titled ‘Client Downloads’, and I’ve placed a new instance of the Repository module on the page. I set the title of the module, setup my module roles to allow everyone to download, rate and comment, and only my Administrators can upload and moderate.

image_thumb1

My page will now look like this

image_thumb4

Custom Templates:

The best way to customize a template is to start with an existing one. However, you don’t want to make changes to the templates stored in /DesktopModules/Repository/Templates because those are the standard templates and will be overwritten by future module upgrades. You should copy the template folder and make a new one with a new name so it will not be overwritten. If you do that in the DesktopModules/Repository/Templates folder, then your new template will be available to all portals on your site. You also have the option of creating a portal-specific template that will only be used in that one portal. To do that you must create a folder named ‘RepositoryTemplates’ under the portal root, then copy the template folder there. When you are selecting a template to use for your module in the module settings page, templates that are portal-specific will be preficed with an asterisk. In the picture below, you can see that default2 is a template that is portal-specific and stored in the Portals/#/RepositoryTemplates folder. All the other templates are global and stored in the /DesktopModules/Repository/Templates folder.

image_thumb6

So, let’s copy the ‘default’ folder from /DesktopModules/Repository/Templates and paste it into our /Portals/#/RepositoryTemplates folder. Next, we edit the form.html file (which is the Upload / Edit form) and we add the new [SECURITYROLES] token. We’ll add this section right after the Author Email field.

 
 Security Roles 
 [SECURITYROLES] 

Now, when we upload a file to this Repository, using our new modified template, we’ll see a checkbox list of security roles that will allow us to require membership in one or more roles in order to be able to see or download this item.

image_thumb9

Leaving all the roles unchecked will result in the item being ‘public’, ie: everyone will see the file and based on our module settings, everyone will be able to download it.

Checking ‘Registered Users’, will allow only members of the Registered Users role to see / download the file.

Checking both ‘Registered Users’ and ‘Subscribers’ will allow only those users who are members of BOTH roles to see / download the file.

If you want to dipslay the required security roles on the actual items as they are listed, edit the template.html file and add a [SECURITYROLES] token where you would like them to show and for each item, the required roles will be displayed.

NOTE: The roles are respected by the companion Dashboard module as well, so if you have a Dashboard associated with the module, and have it configured to show the ‘Latest Uploads’, then when a user visits the page, only the files that they have access to based on the security role requirements will be displayed in the Dashboard module.

This new feature should open up the Repository Module to some exciting new uses. Please let me know how you like the new feature, if you have any questions or problems, please use the module forum on dotnetnuke.com.

Thanks and Enjoy!

LINKS:

Download the 3.5.1 Beta version of the Repository Module

Visit the Support Forum for the Repository Module on DotNetNuke.com

Tags:
Categories:
Search
Privacy Statement | Terms Of Use | Copyright 2007-2009 by Gooddogs.com