Example usage for com.liferay.portal.kernel.util PropsKeys SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED

List of usage examples for com.liferay.portal.kernel.util PropsKeys SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED.

Prototype

String SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED

To view the source code for com.liferay.portal.kernel.util PropsKeys SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED.

Click Source Link

Usage

From source file:com.liferay.asset.publisher.web.internal.SitesThatIAdministerItemSelectorView.java

License:Open Source License

@Override
public boolean isVisible(ThemeDisplay themeDisplay) {
    Group siteGroup = themeDisplay.getSiteGroup();

    if (siteGroup.isLayoutPrototype()) {
        return false;
    }//www. java2s .com

    if (siteGroup.isLayoutSetPrototype()) {
        return false;
    }

    if (PrefsPropsUtil.getBoolean(themeDisplay.getCompanyId(),
            PropsKeys.SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED)) {

        return true;
    }

    return false;
}

From source file:com.liferay.asset.publisher.web.internal.util.AssetPublisherWebUtil.java

License:Open Source License

public boolean isScopeIdSelectable(PermissionChecker permissionChecker, String scopeId, long companyGroupId,
        Layout layout, boolean checkPermission) throws PortalException {

    long groupId = _assetPublisherUtil.getGroupIdFromScopeId(scopeId, layout.getGroupId(),
            layout.isPrivateLayout());/*from ww  w. java2  s  . c  om*/

    if (scopeId.startsWith(AssetPublisherUtil.SCOPE_ID_CHILD_GROUP_PREFIX)) {

        Group group = _groupLocalService.getGroup(groupId);

        if (!group.hasAncestor(layout.getGroupId())) {
            return false;
        }
    } else if (scopeId.startsWith(AssetPublisherUtil.SCOPE_ID_PARENT_GROUP_PREFIX)) {

        Group siteGroup = layout.getGroup();

        if (!siteGroup.hasAncestor(groupId)) {
            return false;
        }

        Group group = _groupLocalService.getGroup(groupId);

        if (SitesUtil.isContentSharingWithChildrenEnabled(group)) {
            return true;
        }

        if (!PrefsPropsUtil.getBoolean(layout.getCompanyId(),
                PropsKeys.SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED)) {

            return false;
        }

        if (checkPermission) {
            return GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.UPDATE);
        }
    } else if ((groupId != companyGroupId) && checkPermission) {
        return GroupPermissionUtil.contains(permissionChecker, groupId, ActionKeys.UPDATE);
    }

    return true;
}

From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java

License:Open Source License

public static boolean isScopeIdSelectable(PermissionChecker permissionChecker, String scopeId,
        long companyGroupId, Layout layout, boolean checkPermission) throws PortalException {

    long groupId = getGroupIdFromScopeId(scopeId, layout.getGroupId(), layout.isPrivateLayout());

    if (scopeId.startsWith(SCOPE_ID_CHILD_GROUP_PREFIX)) {
        Group group = _groupLocalService.getGroup(groupId);

        if (!group.hasAncestor(layout.getGroupId())) {
            return false;
        }/*from   w w w .  ja v a 2 s.  c  o m*/
    } else if (scopeId.startsWith(SCOPE_ID_PARENT_GROUP_PREFIX)) {
        Group siteGroup = layout.getGroup();

        if (!siteGroup.hasAncestor(groupId)) {
            return false;
        }

        Group group = _groupLocalService.getGroup(groupId);

        if (SitesUtil.isContentSharingWithChildrenEnabled(group)) {
            return true;
        }

        if (!PrefsPropsUtil.getBoolean(layout.getCompanyId(),
                PropsKeys.SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED)) {

            return false;
        }

        if (checkPermission) {
            return GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.UPDATE);
        }
    } else if ((groupId != companyGroupId) && checkPermission) {
        return GroupPermissionUtil.contains(permissionChecker, groupId, ActionKeys.UPDATE);
    }

    return true;
}

From source file:com.liferay.content.targeting.util.ContentTargetingUtil.java

License:Open Source License

public static long[] getSharedContentSiteGroupIds(long companyId, long groupId, long userId)
        throws PortalException, SystemException {

    Set<Group> groups = new LinkedHashSet<Group>();

    Group siteGroup = doGetCurrentSiteGroup(groupId);

    if (siteGroup != null) {

        // Current site

        groups.add(siteGroup);/*from   w ww . j  ava2  s.  com*/

        // Layout scopes

        groups.addAll(GroupLocalServiceUtil.getGroups(siteGroup.getCompanyId(), Layout.class.getName(),
                siteGroup.getGroupId()));
    }

    // Administered sites

    if (PrefsPropsUtil.getBoolean(companyId, PropsKeys.SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED)) {

        LinkedHashMap<String, Object> groupParams = new LinkedHashMap<String, Object>();

        groupParams.put("site", Boolean.TRUE);
        groupParams.put("usersGroups", userId);

        groups.addAll(GroupLocalServiceUtil.search(companyId, null, null, groupParams, QueryUtil.ALL_POS,
                QueryUtil.ALL_POS, null));
    }

    // Descendant sites

    groups.addAll(getDescendants(siteGroup, true));

    // Ancestor sites and global site

    int sitesContentSharingWithChildrenEnabled = PrefsPropsUtil.getInteger(companyId,
            PropsKeys.SITES_CONTENT_SHARING_WITH_CHILDREN_ENABLED);

    if (sitesContentSharingWithChildrenEnabled != Sites.CONTENT_SHARING_WITH_CHILDREN_DISABLED) {

        groups.addAll(doGetAncestorSiteGroups(groupId, true));
    }

    long[] groupIds = new long[groups.size()];

    int i = 0;

    for (Group group : groups) {
        groupIds[i++] = group.getGroupId();
    }

    return groupIds;
}

From source file:com.slemarchand.peoplepublisher.util.PeoplePublisherImpl.java

License:Open Source License

@Override
public boolean isScopeIdSelectable(PermissionChecker permissionChecker, String scopeId, long companyGroupId,
        Layout layout) throws PortalException, SystemException {

    long groupId = getGroupIdFromScopeId(scopeId, layout.getGroupId(), layout.isPrivateLayout());

    if (scopeId.startsWith(SCOPE_ID_CHILD_GROUP_PREFIX)) {
        Group group = GroupLocalServiceUtil.getGroup(groupId);

        if (!group.hasAncestor(layout.getGroupId())) {
            return false;
        }/*from   w w w.  j av a  2 s. c o m*/
    } else if (scopeId.startsWith(SCOPE_ID_PARENT_GROUP_PREFIX)) {
        Group siteGroup = layout.getGroup();

        if (!siteGroup.hasAncestor(groupId)) {
            return false;
        }

        Group group = GroupLocalServiceUtil.getGroup(groupId);

        if (SitesUtil.isContentSharingWithChildrenEnabled(group)) {
            return true;
        }

        if (!PrefsPropsUtil.getBoolean(layout.getCompanyId(),
                PropsKeys.SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED)) {

            return false;
        }

        return GroupPermissionUtil.contains(permissionChecker, groupId, ActionKeys.UPDATE);
    } else if (groupId != companyGroupId) {
        return GroupPermissionUtil.contains(permissionChecker, groupId, ActionKeys.UPDATE);
    }

    return true;
}