Mojo Membership with Roles

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.
10/28/2017 4:27:49 AM
Gravatar
Total Posts 12
Ramesh Menta

Mojo Membership with Roles

I have developed my own web application. I would like to use Mojo Membership with Roles in my project. I have been looking for solution to this in our forums but in vain. Please suggest how can i achieve this.

Thanks in advance.

10/29/2017 10:51:16 AM
Gravatar
Total Posts 2253

Re: Mojo Membership with Roles

Hi,

You can use the roles and users in mojoPortal within your own modules fairly easily. The documentation is lacking on this and we'll probably use this post as a base for new docs.

There are several helper methods you can use to determine if a user is in a particular role or if they are in a role which has been assigned a system permission. These methods are in the mojoPortal.Business.WebHelpers.WebUser class.

  • bool IsInRole(string role)
    • Example: WebUser.IsInRole("Foo");
  • bool IsInRoles(string roles) 
    • Example: WebUser.IsInRoles("Foo;Bar;");
  • bool IsInRoles(IList roles)
    • Example:
      var roles = new List<String> { "Foo", "Bar" };
      WebUser.IsInRoles(roles);		
  • bool IsAdmin
  • bool IsContentAdmin
  • bool IsContentPublisher
  • bool IsContentAuthor
  • bool IsRoleAdmin
  • bool IsNewsletterAdmin
  • bool IsAdminOrContentAdmin
  • bool IsAdminOrContentAdminOrContentAuthor
  • bool IsAdminOrContentAdminOrContentPublisher
  • bool IsAdminOrContentAdminOrContentPublisherOrContentAuthor
  • bool IsAdminOrContentAdminOrRoleAdmin
  • bool IsAdminOrRoleAdmin
  • bool IsAdminOrContentAdminOrRoleAdminOrNewsletterAdmin
  • bool IsAdminOrNewsletterAdmin
  • bool HasEditPermissions(int siteId, int moduleId, int pageId)

Any page which inherits from mojoBasePage should also be able to use the following methods:

  • UserCanViewPage()
  • UserCanViewPage(int moduleId)
  • UserCanViewPage(int moduleId, Guid featureGuid)
  • UserCanEditModule()

Finally, SiteSettings has several site permission strings available that can be used with the WebUser methods to determine if a user has a particular Site Permission. These are just strings of roles (separated by semi-colon) so you can use WebUser.IsInRoles(siteSettings.RolesThatCanCreateUsers) to determine if the user is in a role defined by a particular permission.

  • SiteRootEditRoles
  • SiteRootDraftEditRoles
  • SiteRootDraftApprovalRoles
  • CommerceReportViewRoles
  • RolesThatCanCreateRootPages
  • RolesThatCanViewMemberList
  • RolesThatCanCreateUsers
  • RolesThatCanManageUsers
  • RolesThatCanViewMyPage
  • RolesThatCanLookupUsers
  • RolesNotAllowedToEditModuleSettings
  • RolesThatCanEditContentTemplates
  • GeneralBrowseAndUploadRoles
  • UserFilesBrowseAndUploadRoles
  • RolesThatCanDeleteFilesInEditor
  • RolesThatCanAssignSkinsToPages
  • RolesThatCanManageSkins
  • DefaultRootPageViewRoles
  • DefaultRootPageEditRoles
  • DefaultRootPageCreateChildPageRoles

I hope this helps. If you have questions, please ask.

Thanks,
Joe

 

10/29/2017 11:13:53 AM
Gravatar
Total Posts 12
Ramesh Menta

Re: Mojo Membership with Roles

Thanks Joe for speedy response. I will follow this...
You must sign in to post in the forums. This thread is closed to new posts.