Example usage for com.liferay.portal.kernel.security.permission ActionKeys ADD_COMMUNITY

List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys ADD_COMMUNITY

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission ActionKeys ADD_COMMUNITY.

Prototype

String ADD_COMMUNITY

To view the source code for com.liferay.portal.kernel.security.permission ActionKeys ADD_COMMUNITY.

Click Source Link

Usage

From source file:com.liferay.site.admin.web.internal.display.context.SiteAdminDisplayContext.java

License:Open Source License

public boolean hasAddChildSitePermission(Group group) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!group.isCompany() && (PortalPermissionUtil.contains(permissionChecker, ActionKeys.ADD_COMMUNITY)
            || GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.ADD_COMMUNITY))) {

        return true;
    }//from w  w w .jav  a2 s . co  m

    return false;
}

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java

License:Open Source License

@Override
public Group createGroup(long parentGroupId, long liveGroupId, Map<Locale, String> nameMap,
        Map<Locale, String> descriptionMap, int type, boolean manualMembership, int membershipRestriction,
        String friendlyURL, boolean site, boolean inheritContent, boolean active) throws PortalException {

    _log.info("Creating new group ...");

    _log.debug("    security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_COMMUNITY);

    _log.debug("    ... processing ...");

    User user = this.getGuestOrUser();

    com.liferay.portal.kernel.service.ServiceContext serviceContext = new com.liferay.portal.kernel.service.ServiceContext();
    serviceContext.setUserId(user.getUserId());
    serviceContext.setCompanyId(user.getCompanyId());

    return GroupLocalServiceUtil.addGroup(user.getUserId(), parentGroupId, null, 0L, liveGroupId, nameMap,
            descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, site, inheritContent,
            active, serviceContext);/*from   w w  w  . j a va  2  s .c  om*/

}

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularSiteServiceImpl.java

License:Open Source License

@Override
public Group createSite(long parentSiteId, long liveGroupId, Map<Locale, String> nameMap,
        Map<Locale, String> descriptionMap, int type, boolean manualMembership, int membershipRestriction,
        String friendlyURL, boolean site, boolean inheritContent, boolean active) throws PortalException {

    _log.info("Creating new site ...");

    _log.debug("    security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_COMMUNITY);

    _log.debug("    ... processing ...");

    User user = this.getGuestOrUser();

    com.liferay.portal.kernel.service.ServiceContext serviceContext = new com.liferay.portal.kernel.service.ServiceContext();
    serviceContext.setUserId(user.getUserId());
    serviceContext.setCompanyId(user.getCompanyId());

    return GroupLocalServiceUtil.addGroup(user.getUserId(), parentSiteId, null, 0L, liveGroupId, nameMap,
            descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, site, inheritContent,
            active, serviceContext);/*ww w  .  j  av a  2  s.co  m*/
}