Basics in limiting public access to documentsEdit
This guide is based on the site installed with the Website Wizard package and is therefore referencing specific templates and documenttypes from this installation. However the basics apply to other templates and documenttypes as well.
You have two ways of protecting one or more documents in Umbraco.
- Access based on a simple shared login and password.
- Access based on memberGroups - memberTypes and Members
Install the Member Controls packageEdit
After installing the package you will have 3 new macros in your Developer/Macros section.
- Member Login
- Member Password Reminder
- Member Signup
Create a templateEdit
You need to create a template to hold the login function. This has to be done for either approach and is done in the 'Settings' section of your Umbraco installation.
- Rightclick on 'Templates' and click 'Create'.
- Give the template a descriptive name fx. 'Login'
- Go to the Textpage template and copy alt its contents to the clipboard
- Go to your newly created Login template and paste the contents of your clipboard
- Set the Login template's parent template to your master template
- Make a new line right after your '<?UMBRACO_GETITEM field="bodyText"/>'
- Add in a '<?ASPNET_FORM>' field.
- Click 'Insert umbraco macro' icon in the toolbar and select 'Member Login' from the dropdown combo and click 'OK'
- Add in a '</?ASPNET_FORM>' after the macro insert.
- Fill in the fields with your desired text and click 'OK'
- Save your template
- Finally allow the basic document to inherit the Login template by opening 'Document Types', clicking your 'Textpage' type and in the 'Allowed Templates' section check the 'Login' template
- Save your document type
Create a login page.Edit
- Go to the 'Contents' of your installation.
- Rightclick on your 'Frontpage' document and select 'Create'
- Set your document type to 'Textpage' and name it 'Login' (or whatever you prefer) and click 'OK'
- Select your new 'Login' document
- Select 'Properties' and change the template to the 'Login' template
- Save your document
Protect your document(s)Edit
If the document you are applying protection to has child documents these documents are protected as well.
The easy approach to protecting documents is one single username/password and this is achieved by
- Right-clicking your document and selecting 'Public Access'
- Select the 'Simple: ....' link
- Fill in username and password
- Click 'Choose' to select your login page and browse to your 'Login' document
- Do the same with 'Error page' and select your 'Login' document
- Click 'Update'
If you want more control over the access to the documents you can apply security on a memberGroup basis.
If you choose this approach you will have to go to the Members Section before applying security on the document(s).
- In the Members Section you start by adding a Member Group.
- The Member Group can contain several different Member Types which can be assigned to Members.
- When you have created a Member Group and at least one Member Type, create a user.
If you start using Member Groups you might want to look into how to create password reminders and even automated user registration.
When assigning security on documents it is important to remember that both Login page and Error page has to be defined. They can easily be the same page but both has to be selected. If you fail to do so you will get a servererror when trying to update the settings.
--F.Hundewadt 07:47, 7 August 2006 (UTC)