public static boolean contains( PermissionChecker permissionChecker, MicroblogsEntry microblogsEntry, String actionId) { if (actionId.equals(ActionKeys.DELETE) || actionId.equals(ActionKeys.UPDATE)) { if (permissionChecker.hasOwnerPermission( microblogsEntry.getCompanyId(), MicroblogsEntry.class.getName(), microblogsEntry.getMicroblogsEntryId(), microblogsEntry.getUserId(), actionId)) { return true; } return false; } if (permissionChecker.hasOwnerPermission( microblogsEntry.getCompanyId(), MicroblogsEntry.class.getName(), microblogsEntry.getMicroblogsEntryId(), microblogsEntry.getUserId(), actionId)) { return true; } if (microblogsEntry.getSocialRelationType() == 0) { return true; } if ((microblogsEntry.getUserId() != permissionChecker.getUserId()) && SocialRelationLocalServiceUtil.hasRelation( permissionChecker.getUserId(), microblogsEntry.getUserId(), microblogsEntry.getSocialRelationType())) { return true; } return false; }
protected void validate(int type, long parentMicroblogsEntryId) throws PortalException { if (parentMicroblogsEntryId == 0) { return; } MicroblogsEntry microblogsEntry = microblogsEntryPersistence.findByPrimaryKey(parentMicroblogsEntryId); if (microblogsEntry.getSocialRelationType() == MicroblogsEntryConstants.TYPE_EVERYONE) { return; } if (type == MicroblogsEntryConstants.TYPE_REPOST) { throw new UnsupportedMicroblogsEntryException(); } }