This project has moved and is read-only. For the latest updates, please go here.

Is there a way to get the list of categories that are allowed for a role?

Feb 10, 2011 at 7:14 PM

I'm a newbie to Graffiti CMS, so forgive me if this is an easy question.

I have created 2 user roles, each of which has read access to a different set of categories. I would like to display a list of links  that contains ONLY the categories to which the role has access, however I can't figure out a way to do that.

What I'm thinking is something like this:

#foreach ($role in $user.Roles)

   #$foreach ($category in $role.Categories) <-- some way to get the list of categories for this role

               <a title="$category.Name" href="$category.url">$category.Name</a>




Or, even better, is there a call to verify whether a category is enabled for a role?

Something like this:

#if ($role.HasPermission("read", $category))

               <a title="$category.Name" href="$category.url">$category.Name</a>