diff options
2 files changed, 21 insertions, 14 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransactionAccessHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransactionAccessHandler.java index 30ee6548c1f..1f48bb04770 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransactionAccessHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransactionAccessHandler.java @@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.access.AccessDataQuery; import org.eclipse.osee.framework.core.services.IAccessControlService; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.utility.DbUtil; /** * @author Jeff C. Phillips @@ -34,20 +35,22 @@ public class SkynetTransactionAccessHandler extends SkynetTransactionHandler { @Override public IStatus onCheck(IProgressMonitor monitor) { IStatus status = Status.OK_STATUS; - try { - AccessDataQuery accessData = service.getAccessData(getUserArtifact(), getItemsToPersist()); - if (!accessData.matchesAll(getItemsToPersist(), PermissionEnum.WRITE)) { - //TODO Make access denied message more descriptive - status = - new Status( - IStatus.ERROR, - Activator.PLUGIN_ID, - String.format( - "Access Denied - does not have valid permission to edit this artifact\n objects:[%s]\naccessData:[%s]", - getItemsToPersist(), accessData)); + if (!DbUtil.isDbInit()) { + try { + AccessDataQuery accessContext = service.getAccessData(getUserArtifact(), getItemsToPersist()); + if (!accessContext.matchesAll(getItemsToPersist(), PermissionEnum.WRITE)) { + //TODO Make access denied message more descriptive + status = + new Status( + IStatus.ERROR, + Activator.PLUGIN_ID, + String.format( + "Access Denied - does not have valid permission to edit this artifact\n itemsToPersist:[%s]\n accessContext:[%s]", + getItemsToPersist(), accessContext)); + } + } catch (OseeCoreException ex) { + status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error during access check", ex); } - } catch (OseeCoreException ex) { - status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error during access check", ex); } return status; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java index 23b950a6187..a071357870b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/DbUtil.java @@ -18,9 +18,13 @@ import org.eclipse.osee.framework.database.core.ConnectionHandler; /** * @author Donald G. Dunne */ -public class DbUtil { +public final class DbUtil { private static boolean isInDbInit; + private DbUtil() { + // Utility Class - class should only have static methods + } + public static void getTableRowCounts(Map<String, Integer> tableCount, Collection<String> tableNames) throws OseeDataStoreException { for (String tableName : tableNames) { tableCount.put(tableName, getTableRowCount(tableName)); |