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

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

Introduction

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

Prototype

String VIEW

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

Click Source Link

Usage

From source file:com.liferay.message.boards.web.internal.asset.MBCategoryAssetRenderer.java

License:Open Source License

@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) throws PortalException {

    return MBCategoryPermission.contains(permissionChecker, _category, ActionKeys.VIEW);
}

From source file:com.liferay.message.boards.web.internal.asset.MBMessageAssetRenderer.java

License:Open Source License

@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) throws PortalException {

    if (_message.isDiscussion()) {
        return MBDiscussionPermission.contains(permissionChecker, _message.getMessageId(), ActionKeys.VIEW);
    } else {/*from  w w  w .  j  ava2s  .  c om*/
        return MBMessagePermission.contains(permissionChecker, _message, ActionKeys.VIEW);
    }
}

From source file:com.liferay.message.boards.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static MBCategory getCategory(HttpServletRequest request) throws Exception {

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

    String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName");

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (mvcRenderCommandName.equals("/message_boards/view_banned_users")
            && !MBPermission.contains(permissionChecker, themeDisplay.getScopeGroupId(), ActionKeys.BAN_USER)) {

        throw new PrincipalException.MustHavePermission(permissionChecker, ActionKeys.BAN_USER);
    }//from w  ww.ja  va 2  s . com

    MBBanLocalServiceUtil.checkBan(themeDisplay.getScopeGroupId(), themeDisplay.getUserId());

    long categoryId = ParamUtil.getLong(request, "mbCategoryId");

    MBCategory category = null;

    if (categoryId > 0) {
        category = MBCategoryServiceUtil.getCategory(categoryId);
    } else {
        MBPermission.check(permissionChecker, themeDisplay.getScopeGroupId(), ActionKeys.VIEW);
    }

    return category;
}

From source file:com.liferay.microblogs.web.internal.asset.MicroblogsEntryAssetRenderer.java

License:Open Source License

@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {
    try {/*from   www  . ja v  a  2s . c  o  m*/
        return _microblogsEntryModelResourcePermission.contains(permissionChecker, _entry, ActionKeys.VIEW);
    } catch (Exception e) {
    }

    return false;
}

From source file:com.liferay.microblogs.web.internal.social.MicroblogsActivityInterpreter.java

License:Open Source License

@Override
protected boolean hasPermissions(PermissionChecker permissionChecker, SocialActivity activity, String actionId,
        ServiceContext serviceContext) throws Exception {

    return _microblogsEntryModelResourcePermission.contains(permissionChecker, activity.getClassPK(),
            ActionKeys.VIEW);
}

From source file:com.liferay.mobile.device.rules.service.impl.MDRActionServiceImpl.java

License:Open Source License

@Override
public MDRAction fetchAction(long actionId) throws PortalException {
    MDRAction action = mdrActionLocalService.fetchAction(actionId);

    if (action != null) {
        _mdrRuleGroupInstanceModelResourcePermission.check(getPermissionChecker(),
                action.getRuleGroupInstanceId(), ActionKeys.VIEW);
    }// ww w. jav  a 2 s.  c o  m

    return action;
}

From source file:com.liferay.mobile.device.rules.service.impl.MDRActionServiceImpl.java

License:Open Source License

@Override
public MDRAction getAction(long actionId) throws PortalException {
    MDRAction action = mdrActionPersistence.findByPrimaryKey(actionId);

    _mdrRuleGroupInstanceModelResourcePermission.check(getPermissionChecker(), action.getRuleGroupInstanceId(),
            ActionKeys.VIEW);

    return action;
}

From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleGroupServiceImpl.java

License:Open Source License

@Override
public MDRRuleGroup copyRuleGroup(long ruleGroupId, long groupId, ServiceContext serviceContext)
        throws PortalException {

    PermissionChecker permissionChecker = getPermissionChecker();

    MDRRuleGroup ruleGroup = getRuleGroup(ruleGroupId);

    _mdrRuleGroupModelResourcePermission.check(permissionChecker, ruleGroup, ActionKeys.VIEW);

    _portletResourcePermission.check(permissionChecker, groupId, ActionKeys.ADD_RULE_GROUP);

    return mdrRuleGroupLocalService.copyRuleGroup(ruleGroup, groupId, serviceContext);
}

From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleGroupServiceImpl.java

License:Open Source License

@Override
public MDRRuleGroup fetchRuleGroup(long ruleGroupId) throws PortalException {

    MDRRuleGroup ruleGroup = mdrRuleGroupPersistence.fetchByPrimaryKey(ruleGroupId);

    if (ruleGroup != null) {
        _mdrRuleGroupModelResourcePermission.check(getPermissionChecker(), ruleGroup, ActionKeys.VIEW);
    }/*from   ww w  .j a  v a  2 s.co m*/

    return ruleGroup;
}

From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleGroupServiceImpl.java

License:Open Source License

@Override
public MDRRuleGroup getRuleGroup(long ruleGroupId) throws PortalException {
    MDRRuleGroup ruleGroup = mdrRuleGroupPersistence.findByPrimaryKey(ruleGroupId);

    _mdrRuleGroupModelResourcePermission.check(getPermissionChecker(), ruleGroup, ActionKeys.VIEW);

    return ruleGroup;
}