About Orchard Permissions

Topics: Core, Customizing Orchard
Nov 20, 2012 at 5:51 AM
Edited Nov 20, 2012 at 5:52 AM

I have really simple questions about permissions.

I saw how Orchard.Blogs module implemented the interface IPermissionProvider. And I created one for my own module (Orchard.MyModule), and within my module there are two content types (MyObjectAlpha, MyObjectBeta).

In the Admin window, role editing display. there are three groups of permissions generated:

  1. Orchard.MyModule Feature - generated from the implementation of IPermissionProvider
  2. MyObjectAlpha - dynamically generated from the content type
  3. MyObjectBeta - dynamically generated from the content type

Here is my question:

1. How can I hide the permission group 2 (MyObjectAlpha), since I have implemented it in the permission group 1 (Orchard.MyModule Feature)? Such as there is no permission group for Blog content type.

2. How can I utilize the dynamically generated permission group 3 (MyObjectBeta) within in my code? For example:


Nov 23, 2012 at 2:18 AM

What do you mean "dynamically generated"?

Dec 10, 2012 at 4:34 AM

Because, whenever I create a content type, the corresponding permission editing section will be displayed in the Role Editing page.

Dec 14, 2012 at 3:25 AM

Ah, ok.

I think the answers are:

1. you can't

2. You can use Permission.Named("the name of the permission") instead of Permissions.EditOwnMyObjectBeta.

Dec 14, 2012 at 6:48 AM

Many thanks for your reply, it is very helpful.