This project is read-only.

using permission authorization

Nov 23, 2010 at 1:05 PM

I want to use permission authorization in my module in cshtml page


Such as !AuthorizedFor(Permissions.AddComment)


I have even added @using Orchard.Security;
@using Orchard.Utility.Extensions;

In my page


But this gives me error as CS0103: The name 'Permissions' does not exist in the current context



Rajan J Dmello

Nov 23, 2010 at 2:09 PM

Hi team,

even i want to check 

"AccessAdminPanel" permission on cshtml page of my module 
So please tell steps i should follow 

Rajan J Dmello
Nov 23, 2010 at 5:40 PM

I think the problem is not in the namespaces you include, it's that your cshtml is not running in the proper context. I'm suspecting that you're accessing it directly instead of through the Orchard pipeline and because of that it doesn't have the proper base class. Can you explain more precisely how you got there?

Nov 23, 2010 at 10:31 PM

Also be sure to try adding a using for the namespace of the specific permission. For example Permissions. AddComment is in Orchard.Comments.

Dec 17, 2010 at 12:14 PM
Edited Dec 23, 2010 at 5:48 AM


In sort and simple

User with admin role only should see one of My link on Home page

and for other user should not be displayed

What should I do

Please help me




Rajan J Dmello