Just as we protected any number of pages from unauthorized viewing, we can protect parts of those pages. With group access levels deployed, any page element can be modified so that it is seen only by members of certain groups. In this recipe, we will allow only those with the highest level of accessadministratorsto view particular navigation links. Make Elements ConditionalBecause we want the conditional display to be a part of every page in the applicationincluding those already builtthe application template must be modified. Dreamweaver maintains a connection to all files derived from a template, so changes can be propagated automatically to affected documents. If you've already posted some files to your remote server, you'll need to upload them again after the template changes are applied. Note Although you should exercise care when making changes to any document, you need to be extra careful when applying alterations to templates because of the potential ramifications for numerous files. In this step, we'll select the page elementshere, two rows of a table used for navigationprior to applying the code.
The code snippet checks to see whether the session object MM_UserAuthorization (MM_UserGroup for PHP) is set to 1, the administrator designation as defined in the data source. The resulting effect is that the links to administrative pages are visible only by administrators. Be sure to save your template and update all derived documents. |