how to create/define permission on screen ?

Topics: Administration, Announcements, Core, Customizing Orchard, General, Troubleshooting, Writing modules, Writing themes
Jun 18, 2012 at 10:55 AM
Edited Jun 18, 2012 at 10:58 AM

How/where do I create/define a new permission for a role?

Can anybody shed light on this?

Developer
Jun 18, 2012 at 10:59 AM

If you want to introduce a new permission, just have a look at the Blogs module's Permissions.cs. As you'll see, permissions are defined as static fields and returned as part of a list in the GetPermissions call. This list will then show up in the Edit Role screen.

Jun 18, 2012 at 11:12 AM
Edited Jun 18, 2012 at 11:12 AM

@sfmskywalker

Does your suggestion imply I should poke around in the source code?

What does a user do on the screen? When I look at the figures on this page
http://docs.orchardproject.net/Documentation/Managing-users-and-roles
I see nowhere for the user to define a new permission.

Developer
Jun 18, 2012 at 11:28 AM

That's correct. Think about it: imagine there actually were a screen where you could create new permissions. What would a permission imply exactly? Does it allow access to your custom controllers and actions? Or delete products? Execute a super-secret algorithm that only users in a certain role are allowed to do? Whatever the answer, it would have to be implemented by your module that exposes the permission.

Or are you simply looking to attach existing permissions to new roles?