Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2018-11-05 20:22:34 +0000
committerdonald.g.dunne2018-11-08 20:48:00 +0000
commit55e5538d025bd467af25d604296e623477ba97c9 (patch)
treeced82d342885295dd99407a3074c5f7825bf50fa
parent208e80ac450e7307fef09f630553f7d4c7d95b1a (diff)
downloadorg.eclipse.osee-55e5538d025bd467af25d604296e623477ba97c9.tar.gz
org.eclipse.osee-55e5538d025bd467af25d604296e623477ba97c9.tar.xz
org.eclipse.osee-55e5538d025bd467af25d604296e623477ba97c9.zip
bug[ats_TW11516]: Show dialog for deny branch access in BranchXViewer
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java7
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IAccessControlService.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java33
4 files changed, 34 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java
index 26d48129c5..416ec1bfc7 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java
@@ -439,10 +439,11 @@ public class AccessControlService implements IAccessControlService {
}
}
}
+ // user does not have entry in the branch access control table for this branch
if (userPermission == null) {
- if (!CoreBranches.COMMON.equals(accessObject.getBranch()) && BranchManager.getType(
- accessObject.getBranch()).isBaselineBranch()) {
- userPermission = PermissionEnum.READ;
+ // If there are any other access on this branch, it's locked for this user
+ if (objectToSubjectCache.containsKey(accessObject)) {
+ userPermission = PermissionEnum.DENY;
} else {
userPermission = PermissionEnum.FULLACCESS;
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IAccessControlService.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IAccessControlService.java
index df54eede93..475015d644 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IAccessControlService.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IAccessControlService.java
@@ -19,6 +19,9 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
public interface IAccessControlService {
+ /**
+ * @param object Artifact, Branch or collection of either
+ */
boolean hasPermission(Object object, PermissionEnum permission) throws OseeCoreException;
void removePermissions(BranchId branch) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
index bdbe94477c..439412d685 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
@@ -731,4 +731,8 @@ public final class BranchManager {
public static String getBranchShortName(TransactionToken tx) {
return getBranch(tx.getBranch()).getShortName();
}
+
+ public static String toStringWithId(BranchId branch) {
+ return getBranch(branch).toStringWithId();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java
index 99fe96ba8f..675102d6a5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java
@@ -15,10 +15,13 @@ import java.util.Collection;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.nebula.widgets.xviewer.XViewer;
import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
+import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.model.MergeBranch;
+import org.eclipse.osee.framework.core.util.XResultData;
import org.eclipse.osee.framework.help.ui.OseeHelpContext;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
@@ -27,6 +30,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
import org.eclipse.osee.framework.ui.skynet.explorer.ArtifactExplorer;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
+import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI;
import org.eclipse.osee.framework.ui.skynet.util.PromptChangeUtil;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.XBranchWidget.IBranchWidgetMenuListener;
import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
@@ -48,24 +52,33 @@ public class BranchXViewer extends XViewer {
@Override
public void handleDoubleClick() {
+ XResultData rd = new XResultData();
ArrayList<BranchId> branches = xBranchViewer.getSelectedBranches();
if (branches != null && !branches.isEmpty()) {
for (BranchId branch : branches) {
- if (!branch.equals(CoreBranches.SYSTEM_ROOT)) {
- if (!BranchManager.getType(branch).isMergeBranch()) {
- ArtifactExplorer.exploreBranch(branch);
- BranchManager.setLastBranch(branch);
- } else {
- if (branch instanceof MergeBranch) {
- MergeBranch mergeBranch = (MergeBranch) branch;
- IOseeBranch source = mergeBranch.getSourceBranch();
- IOseeBranch destination = mergeBranch.getDestinationBranch();
- MergeView.openView(source, destination, BranchManager.getBaseTransaction(source));
+ boolean hasPermission = AccessControlManager.hasPermission(branch, PermissionEnum.READ);
+ if (hasPermission) {
+ if (!branch.equals(CoreBranches.SYSTEM_ROOT)) {
+ if (!BranchManager.getType(branch).isMergeBranch()) {
+ ArtifactExplorer.exploreBranch(branch);
+ BranchManager.setLastBranch(branch);
+ } else {
+ if (branch instanceof MergeBranch) {
+ MergeBranch mergeBranch = (MergeBranch) branch;
+ IOseeBranch source = mergeBranch.getSourceBranch();
+ IOseeBranch destination = mergeBranch.getDestinationBranch();
+ MergeView.openView(source, destination, BranchManager.getBaseTransaction(source));
+ }
}
}
+ } else {
+ rd.errorf("Access Restricted on branch %s\n", BranchManager.toStringWithId(branch));
}
}
}
+ if (rd.isErrors()) {
+ XResultDataUI.report(rd, "Branch Access Denied");
+ }
}
@Override

Back to the top