custom feature

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/23/2012 11:53:07 AM
Gravatar
Total Posts 21

custom feature roles querying

Hi Joe-

I had a quick question about feature development. Is it possible for a feature to read what roles are allowed to view it? I'd like to be able to read the roles and then write them to another database for a feature I'm developing.

Thanks

5/23/2012 12:29:50 PM
Gravatar
Total Posts 18439

Re: custom feature

Hi Mike,

The thing to understand is that view permissions are primarily determined by the Page view roles, ie if the user is not in an allowed view role for the page that has the feature instance then he cannot view it. A Module aka a feature instance also has a view roles but it is supplemental to the page view roles. If a module instance has empty string or "All Users" for the ViewRoles then it is determined entirely by the page view permissions. If the user is in a role to view the page but the module has a more restrictive viewroles that the user is not in then the module is not loaded on the page for that user. If the user is in an allowed view role for the module but not the page, then he still does not have access to the module. So page view roles are the primary security mechanism and module view permissions can only be used to further restrict access.

If your module control inherits from SiteModuleControl then it has an intrinsic property of the Module and you can get at the module view roles like this:

string moduleViewRoles = this.ModuleConfiguration.ViewRoles;

The current cms page (PageSettings) is also a property on SiteModuleControl for convenience, so you can get at page view roles like this:

string pageViewRoles = this.currentPage.AuthorizedRoles;

these strings will be semi colon separated role names.

As far as storing that info elsewhere keep in mind that it can be changed at any time and your other system would not be in sync.

Hope that helps,

Joe

 

5/23/2012 12:37:07 PM
Gravatar
Total Posts 21

Re: custom feature

That's exactly what I needed. Thanks for the help and the quick response!

You must sign in to post in the forums. This thread is closed to new posts.