@@ -0,0 +1,2155 @@
+/**%0A * OpenCPS is the open source Core Public Services software%0A * Copyright (C) 2016-present OpenCPS community%0A%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * any later version.%0A%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the%0A * GNU Affero General Public License for more details.%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program. If not, see %3Chttp://www.gnu.org/licenses/%3E%0A */%0A%0Apackage org.opencps.usermgt.permissions;%0A%0Aimport org.opencps.usermgt.model.JobPos;%0Aimport org.opencps.usermgt.model.WorkingUnit;%0A%0Aimport com.liferay.portal.kernel.exception.PortalException;%0Aimport com.liferay.portal.kernel.exception.SystemException;%0Aimport com.liferay.portal.security.auth.PrincipalException;%0Aimport com.liferay.portal.security.permission.PermissionChecker;%0A%0Apublic class JobPosPermission %7B%0A%0A%09public static void check(%0A%09%09PermissionChecker permissionChecker, long threadId, String actionId)%0A%09%09throws PortalException, SystemException %7B%0A%0A%09%09if (!contains(permissionChecker, threadId, actionId)) %7B%0A%09%09%09throw new PrincipalException();%0A%09%09%7D%0A%09%7D%0A%0A%09public static void check(%0A%09%09PermissionChecker permissionChecker, JobPos jobPos, String actionId)%0A%09%09throws PortalException, SystemException %7B%0A%0A%09%09if (!contains(permissionChecker, jobPos, actionId)) %7B%0A%09%09%09throw new PrincipalException();%0A%09%09%7D%0A%09%7D%0A%0A%09public static boolean contains(%0A%09%09PermissionChecker permissionChecker, JobPos jobPos, String actionId)%0A%09%09throws PortalException, SystemException %7B%0A%0A%09%09return permissionChecker.hasPermission(%0A%09%09%09jobPos.getGroupId(), WorkingUnit.class.getName(),%0A%09%09%09jobPos.getPrimaryKey(), actionId);%0A%09%7D%0A%0A%09public static boolean contains(%0A%09%09PermissionChecker permissionChecker, long groupId, String actionId) %7B%0A%0A%09%09return permissionChecker.hasPermission(%0A%09%09%09groupId, WorkingUnit.class.getName(), groupId, actionId);%0A%09%7D%0A%7D%0A

Add JobPermission file