Issue #2236 Merged Mike's Code
Change-Id: I78943ceee3aeea1eeb6d815fefd3e82b46d677a6 Former-commit-id:78766d5567
[formerly2049a9b4da
] [formerlye21cc84d16
] [formerly78766d5567
[formerly2049a9b4da
] [formerlye21cc84d16
] [formerlydb7c81a1df
[formerlye21cc84d16
[formerly 7cc09247bc4166f9586867fba097b4c40577464d]]]] Former-commit-id:db7c81a1df
Former-commit-id:be1b52c989
[formerlyfef2b39123
] [formerly 3c1f19617df625bcf1fc232516da55cda0f42bfc [formerlyfe9e969142
]] Former-commit-id: e29bf91bafd2f989787cde4e5cd1e78eb502884c [formerlya6bff7d97f
] Former-commit-id:aa099029be
This commit is contained in:
parent
4af4e587e8
commit
61dd3901ea
31 changed files with 522 additions and 660 deletions
|
@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.site;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.event;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.event;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.plugin.nwsauth;bundle-version="1.12.1174"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework",
|
||||
|
|
|
@ -25,13 +25,13 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.browser.DataBrowserDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 12, 2012 lvenable Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2013 2236 mpduff Refactored Data Delivery Permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,7 +62,8 @@ public class DataBrowserAction extends AbstractHandler {
|
|||
/** Instance of the dialog */
|
||||
private DataBrowserDlg dlg = null;
|
||||
|
||||
private final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_DATASET_BROWSER;
|
||||
private final String permission = DataDeliveryPermission.SUBSCRIPTION_DATASET_BROWSER
|
||||
.toString();
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
@ -73,8 +75,7 @@ public class DataBrowserAction extends AbstractHandler {
|
|||
+ permission;
|
||||
|
||||
if (DataDeliveryServices.getPermissionsService()
|
||||
.checkPermission(user, msg, permission)
|
||||
.isAuthorized()) {
|
||||
.checkPermission(user, msg, permission).isAuthorized()) {
|
||||
if ((dlg == null) || (dlg.isDisposed() == true)) {
|
||||
Shell shell = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell();
|
||||
|
@ -84,7 +85,7 @@ public class DataBrowserAction extends AbstractHandler {
|
|||
dlg.bringToTop();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.notification.NotificationDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 30, 2012 mpduff Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,7 +63,8 @@ public class NotificationAction extends AbstractHandler {
|
|||
private NotificationDlg dlg = null;
|
||||
|
||||
/** Permission string */
|
||||
private final DataDeliveryPermission permission = DataDeliveryPermission.NOTIFICATION_VIEW;
|
||||
private final String permission = DataDeliveryPermission.NOTIFICATION_VIEW
|
||||
.toString();
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
@ -84,7 +86,7 @@ public class NotificationAction extends AbstractHandler {
|
|||
dlg.bringToTop();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ import org.eclipse.core.commands.ExecutionEvent;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
|
||||
|
@ -48,6 +48,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
|
|||
* Jan 10, 2012 mpduff Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,7 +66,8 @@ public class SubscriptionManagerAction extends AbstractHandler {
|
|||
private SubscriptionManagerDlg dlg = null;
|
||||
|
||||
/** Permission String */
|
||||
private final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_VIEW;
|
||||
private final String permission = DataDeliveryPermission.SUBSCRIPTION_VIEW
|
||||
.toString();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -103,7 +105,7 @@ public class SubscriptionManagerAction extends AbstractHandler {
|
|||
dlg.bringToTop();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
|
@ -35,7 +36,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
|
||||
import com.raytheon.uf.viz.datadelivery.filter.MetaDataManager;
|
||||
|
@ -58,6 +58,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
|
|||
* Aug 10, 2012 1022 djohnson Store provider name in {@link SubsetXml}, use GriddedDataSet.
|
||||
* Aug 21, 2012 0743 djohnson Change getMetaData to getDataSet.
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,7 +81,8 @@ public class SubsetAction extends AbstractHandler {
|
|||
/** Dialog instance */
|
||||
private LoadSaveConfigDlg loadDlg = null;
|
||||
|
||||
private final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_EDIT;
|
||||
private final String permission = DataDeliveryPermission.SUBSCRIPTION_EDIT
|
||||
.toString();
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
@ -120,7 +122,7 @@ public class SubsetAction extends AbstractHandler {
|
|||
dlg.bringToTop();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.system.SystemManagementDlg;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import com.raytheon.uf.viz.datadelivery.system.SystemManagementDlg;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 729 jpiatt Initial creation.
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,7 +65,8 @@ public class SystemManagementAction extends AbstractHandler {
|
|||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_VIEW;
|
||||
final String permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_VIEW
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " is not authorized to view Data Delivery System Management\nPermission: "
|
||||
|
@ -84,7 +86,7 @@ public class SystemManagementAction extends AbstractHandler {
|
|||
}
|
||||
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.EnvelopeUtils;
|
||||
|
@ -66,7 +67,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.IDataLoad;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
|
||||
|
@ -117,6 +117,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jun 05, 2013 1800 mpduff Move the area filter below the data type selection.
|
||||
* Jun 06, 2013 2030 mpduff Updates to help.
|
||||
* Jul 05, 2013 2137 mpduff Changed data type to a single select list, changed layout.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -656,7 +657,8 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
|
|||
* Handle retrieving of subscription subset.
|
||||
*/
|
||||
private void handleRetrieveSubscribeAction() {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_CREATE;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_CREATE
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " is not authorized to Create Subscriptions/Queries\nPermission: "
|
||||
|
@ -681,7 +683,7 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
|
|||
shell, data);
|
||||
dlg.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.comm;
|
||||
|
||||
import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
|
||||
import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
|
||||
import com.raytheon.uf.common.auth.resp.UserNotAuthorized;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.INotAuthHandler;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 13, 2012 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DataDeliveryNotAuthHandler implements INotAuthHandler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.requests.INotAuthHandler#notAuthenticated(com
|
||||
* .raytheon.uf.common.auth.resp.UserNotAuthenticated)
|
||||
*/
|
||||
@Override
|
||||
public Object notAuthenticated(UserNotAuthenticated response) throws VizException {
|
||||
AbstractPrivilegedRequest request = response.getRequest();
|
||||
IUser user = request.getUser();
|
||||
String message =
|
||||
"User: <" + user.uniqueId() + "> is not authenticated to perform request:" + request.getClass();
|
||||
UFStatus.getHandler(DataDeliveryNotAuthHandler.class).handle(Priority.PROBLEM, message);
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.requests.INotAuthHandler#notAuthorized(com.raytheon
|
||||
* .uf.common.auth.resp.UserNotAuthorized)
|
||||
*/
|
||||
@Override
|
||||
public Object notAuthorized(UserNotAuthorized response) throws VizException {
|
||||
String message = response.getMessage();
|
||||
if (message == null) {
|
||||
message = "Error sending request for user: " + response.getRequest().getUser().uniqueId().toString();
|
||||
}
|
||||
UFStatus.getHandler(DataDeliveryNotAuthHandler.class).handle(Priority.PROBLEM, message);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -19,11 +19,11 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.services;
|
||||
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
||||
import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService;
|
||||
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
|
||||
import com.raytheon.uf.common.datadelivery.service.subscription.ISubscriptionOverlapService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 09, 2012 1286 djohnson Initial creation
|
||||
* May 20, 2013 2000 djohnson Add subscription overlap service.
|
||||
* Jul 26, 2031 2232 mpduff Moved IPermissionsService to common.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Layout;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||
|
@ -55,7 +56,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.ActivePeriodComp;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.DurationComp;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp;
|
||||
|
@ -101,6 +101,7 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
|||
* May 15, 2013 1040 mpduff Add Shared sites.
|
||||
* Jun 04, 2013 223 mpduff Modify for point data.
|
||||
* Jun 12, 2013 2038 djohnson No longer modal.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -185,8 +186,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
|||
* true for new subscription, false for edit
|
||||
*/
|
||||
public CreateSubscriptionDlg(Shell parent, boolean create) {
|
||||
super(parent, SWT.DIALOG_TRIM,
|
||||
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL
|
||||
| CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
this.create = create;
|
||||
|
||||
if (create) {
|
||||
|
@ -338,7 +339,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
|||
btn.setToolTipText("Select sites for sharing");
|
||||
btn.setEnabled(false);
|
||||
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE;
|
||||
final String permission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE
|
||||
.toString();
|
||||
final IUser user = UserController.getUserObject();
|
||||
final String msg = user.uniqueId()
|
||||
+ " is not authorized to create shared subscriptions. "
|
||||
|
@ -366,7 +368,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
|||
}
|
||||
});
|
||||
}
|
||||
} catch (VizException e1) {
|
||||
} catch (AuthException e1) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
|
||||
}
|
||||
|
|
|
@ -21,13 +21,15 @@ package com.raytheon.uf.viz.datadelivery.subscription;
|
|||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.datadelivery.service.BasePrivilegedDataDeliveryService;
|
||||
import com.raytheon.uf.common.plugin.nwsauth.NwsAuthRequest;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
|
@ -45,6 +47,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* Feb 26, 2013 1643 djohnson Extends base class.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions, removed DataDeliveryAuthRequest.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,24 +56,24 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*/
|
||||
|
||||
public class RequestFromServerPermissionsService extends
|
||||
BasePrivilegedDataDeliveryService<DataDeliveryAuthRequest> implements
|
||||
BasePrivilegedDataDeliveryService<NwsAuthRequest> implements
|
||||
IPermissionsService {
|
||||
|
||||
/**
|
||||
* Adapts the {@link DataDeliveryAuthRequestAdapter} to match the
|
||||
* Adapts the {@link NwsAuthRequestAdapter} to match the
|
||||
* {@link IAuthorizedPermissionResponse} interface.
|
||||
*/
|
||||
private class DataDeliveryAuthRequestAdapter implements
|
||||
private class NwsAuthRequestAdapter implements
|
||||
IAuthorizedPermissionResponse {
|
||||
|
||||
private final DataDeliveryAuthRequest response;
|
||||
private final NwsAuthRequest response;
|
||||
|
||||
/**
|
||||
* The response to adapt.
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
private DataDeliveryAuthRequestAdapter(DataDeliveryAuthRequest response) {
|
||||
private NwsAuthRequestAdapter(NwsAuthRequest response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
|
@ -86,18 +89,22 @@ public class RequestFromServerPermissionsService extends
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean hasPermission(DataDeliveryPermission permission) {
|
||||
public boolean hasPermission(String permission) {
|
||||
return (isAuthorized()) ? response.isAuthorized(permission) : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param user
|
||||
* @param notAuthorizedMessage
|
||||
* @param subscription
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
@Override
|
||||
public IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
|
||||
final IUser user, String notAuthorizedMessage,
|
||||
final Subscription subscription) throws VizException {
|
||||
final Subscription subscription) throws AuthException {
|
||||
|
||||
// TODO: Can this be done better?
|
||||
if (subscription instanceof SiteSubscription) {
|
||||
|
@ -112,20 +119,23 @@ public class RequestFromServerPermissionsService extends
|
|||
|
||||
private IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
|
||||
final IUser user, String notAuthorizedMessage,
|
||||
final SiteSubscription subscription) throws VizException {
|
||||
final SiteSubscription subscription) throws AuthException {
|
||||
|
||||
String approveSitePermission = DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE
|
||||
.toString();
|
||||
String approveUserPermission = DataDeliveryPermission.SUBSCRIPTION_APPROVE_USER
|
||||
.toString();
|
||||
final IAuthorizedPermissionResponse r = checkPermissions(user,
|
||||
notAuthorizedMessage,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_USER);
|
||||
notAuthorizedMessage, approveSitePermission,
|
||||
approveUserPermission);
|
||||
|
||||
// If they have site permissions, then yes they can approve the
|
||||
// subscription
|
||||
if (r.hasPermission(DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE)) {
|
||||
if (r.hasPermission(approveSitePermission)) {
|
||||
return r;
|
||||
} else {
|
||||
// Otherwise they must have user approval permission and be the
|
||||
// owner
|
||||
// ownerBaseServerService
|
||||
return new IAuthorizedPermissionResponse() {
|
||||
@Override
|
||||
public boolean isAuthorized() {
|
||||
|
@ -135,7 +145,7 @@ public class RequestFromServerPermissionsService extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(DataDeliveryPermission permission) {
|
||||
public boolean hasPermission(String permission) {
|
||||
return r.hasPermission(permission);
|
||||
}
|
||||
};
|
||||
|
@ -144,12 +154,12 @@ public class RequestFromServerPermissionsService extends
|
|||
|
||||
private IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
|
||||
final IUser user, String notAuthorizedMessage,
|
||||
final SharedSubscription subscription) throws VizException {
|
||||
final SharedSubscription subscription) throws AuthException {
|
||||
|
||||
// TODO: New permission to approve/change shared subscriptions?
|
||||
final IAuthorizedPermissionResponse r = checkPermissions(user,
|
||||
notAuthorizedMessage,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE);
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE.toString());
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -159,10 +169,10 @@ public class RequestFromServerPermissionsService extends
|
|||
*/
|
||||
@Override
|
||||
public IAuthorizedPermissionResponse checkPermission(IUser user,
|
||||
String notAuthorizedMessage, DataDeliveryPermission permission)
|
||||
throws VizException {
|
||||
String notAuthorizedMessage, String permission)
|
||||
throws AuthException {
|
||||
return checkPermissions(user, notAuthorizedMessage,
|
||||
new DataDeliveryPermission[] { permission });
|
||||
new String[] { permission });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,20 +180,19 @@ public class RequestFromServerPermissionsService extends
|
|||
*/
|
||||
@Override
|
||||
public IAuthorizedPermissionResponse checkPermissions(IUser user,
|
||||
String notAuthorizedMessage, DataDeliveryPermission... permissions)
|
||||
throws VizException {
|
||||
String notAuthorizedMessage, String... permissions)
|
||||
throws AuthException {
|
||||
|
||||
DataDeliveryAuthRequest request = new DataDeliveryAuthRequest();
|
||||
NwsAuthRequest request = new NwsAuthRequest();
|
||||
request.setUser(user);
|
||||
request.addRequestedPermissions(permissions);
|
||||
request.setNotAuthorizedMessage(notAuthorizedMessage);
|
||||
|
||||
try {
|
||||
DataDeliveryAuthRequest r = sendRequest(request,
|
||||
DataDeliveryAuthRequest.class);
|
||||
return new DataDeliveryAuthRequestAdapter(r);
|
||||
NwsAuthRequest r = sendRequest(request, NwsAuthRequest.class);
|
||||
return new NwsAuthRequestAdapter(r);
|
||||
} catch (RemoteException e) {
|
||||
throw new VizException(e);
|
||||
throw new AuthException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.swt.widgets.MenuItem;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
|
@ -62,7 +63,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
|
||||
|
@ -126,6 +126,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Jun 05, 2013 2064 mpduff Fix for filtering combo boxes.
|
||||
* Jun 06, 2013 2030 mpduff Refactored help.
|
||||
* Jun 14, 2013 2064 mpduff Check for null/disposed sort column.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -598,7 +599,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
private void createSubscription() {
|
||||
// check to see if authorized
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_CREATE;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_CREATE
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " is not authorized to create subscriptions";
|
||||
|
@ -614,7 +616,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
statusHandler.handle(
|
||||
com.raytheon.uf.common.status.UFStatus.Priority.ERROR,
|
||||
e.getLocalizedMessage(), e);
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +629,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
private void handleGroupCreate(boolean create) {
|
||||
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_CREATE;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_CREATE
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " is not authorized to access the Dataset Discovery Browser\nPermission: "
|
||||
|
@ -660,7 +663,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred in authorization request", e);
|
||||
}
|
||||
|
@ -720,7 +723,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
return;
|
||||
}
|
||||
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_DELETE;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_DELETE
|
||||
.toString();
|
||||
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
|
@ -778,7 +782,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
job.schedule();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
@ -833,7 +837,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
getShell().setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
|
||||
// Check for activate premissions
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_ACTIVATE;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_ACTIVATE
|
||||
.toString();
|
||||
|
||||
final IUser user = UserController.getUserObject();
|
||||
final String username = user.uniqueId().toString();
|
||||
|
@ -896,7 +901,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1056,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If null get the first one
|
||||
if (sortedTableColumn == null) {
|
||||
sortedTableColumn = tableComp.getTable().getColumn(0);
|
||||
|
@ -1087,12 +1092,16 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
|
||||
return DataDeliveryServices
|
||||
.getPermissionsService()
|
||||
.checkPermissions(user, msg,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_USER,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_VIEW)
|
||||
.isAuthorized();
|
||||
} catch (VizException e) {
|
||||
.checkPermissions(
|
||||
user,
|
||||
msg,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE
|
||||
.toString(),
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_USER
|
||||
.toString(),
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_VIEW
|
||||
.toString()).isAuthorized();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
||||
|
@ -58,7 +60,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.actions.SubscriptionManagerAction;
|
||||
import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
|
@ -86,6 +87,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* May 23, 2013 1650 djohnson Move out some presentation logic to DisplayForceApplyPromptDialog.
|
||||
* Jun 12, 2013 2038 djohnson Launch subscription manager on the UI thread.
|
||||
* Jul 18, 2013 1653 mpduff Add SubscriptionStatusSummary.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -488,7 +490,13 @@ public class SubscriptionService implements ISubscriptionService {
|
|||
final String username = user.uniqueId().toString();
|
||||
|
||||
try {
|
||||
boolean authorized = permissionsService
|
||||
if (!(permissionsService instanceof RequestFromServerPermissionsService)) {
|
||||
throw new RegistryHandlerException(
|
||||
"Invalid Handler "
|
||||
+ permissionsService.getClass()
|
||||
.toString());
|
||||
}
|
||||
boolean authorized = ((RequestFromServerPermissionsService) permissionsService)
|
||||
.checkPermissionToChangeSubscription(user,
|
||||
PENDING_SUBSCRIPTION_AWAITING_APPROVAL,
|
||||
subscription).isAuthorized();
|
||||
|
@ -514,7 +522,7 @@ public class SubscriptionService implements ISubscriptionService {
|
|||
continue;
|
||||
}
|
||||
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.INFO,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Table;
|
|||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
|
@ -56,7 +57,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
|
||||
|
@ -104,10 +104,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
|||
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
|
||||
* Jun 14, 2013 2064 mpduff Null check for sorted column.
|
||||
* Jul 29, 2013 2232 mpduff IndexOutOfBoundsException check.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
@ -220,10 +217,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
* the subscription
|
||||
*/
|
||||
public void editSubscription(Subscription subscription) {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_CREATE;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_EDIT
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " is not authorized to access the Dataset Discovery Browser\nPermission: "
|
||||
+ " is not authorized to edit existing subscriptions.\nPermission: "
|
||||
+ permission;
|
||||
|
||||
try {
|
||||
|
@ -234,7 +232,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
|
||||
dlg.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred in authorization request", e);
|
||||
}
|
||||
|
@ -274,7 +272,8 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
}
|
||||
|
||||
// Check permissions
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_EDIT;
|
||||
final String permission = DataDeliveryPermission.SUBSCRIPTION_EDIT
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId()
|
||||
+ " is not authorized to access Group Add\nPermission: "
|
||||
|
@ -288,7 +287,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
getSelectedSubscription(), this);
|
||||
groupAdd.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred in authorization request", e);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ import org.eclipse.swt.widgets.Menu;
|
|||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService.IAuthorizedPermissionResponse;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
|
@ -48,7 +51,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.notification.INotificationObserver;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationException;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
||||
|
@ -57,8 +59,6 @@ import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager;
|
|||
import com.raytheon.uf.viz.datadelivery.help.HelpManager;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService.IAuthorizedPermissionResponse;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse;
|
||||
|
@ -92,6 +92,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
|
||||
* Jun 06, 2013 2030 mpduff Refactored help.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -352,7 +353,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
|
|||
boolean site = false;
|
||||
|
||||
if (response
|
||||
.hasPermission(DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE)) {
|
||||
.hasPermission(DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE
|
||||
.toString())) {
|
||||
site = true;
|
||||
}
|
||||
|
||||
|
@ -402,10 +404,13 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
|
|||
String msg = user.uniqueId()
|
||||
+ " is not authorized to Approve/Deny subscriptions.";
|
||||
|
||||
return permissionsService.checkPermissions(user, msg,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_USER);
|
||||
} catch (VizException e) {
|
||||
return permissionsService
|
||||
.checkPermissions(user, msg,
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE
|
||||
.toString(),
|
||||
DataDeliveryPermission.SUBSCRIPTION_APPROVE_USER
|
||||
.toString());
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to check user permissions.", e);
|
||||
return new IAuthorizedPermissionResponse() {
|
||||
|
@ -415,7 +420,7 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(DataDeliveryPermission permission) {
|
||||
public boolean hasPermission(String permission) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
@ -441,7 +446,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
|
|||
boolean site = false;
|
||||
|
||||
if (response
|
||||
.hasPermission(DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE)) {
|
||||
.hasPermission(DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE
|
||||
.toString())) {
|
||||
site = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
|
@ -66,13 +68,13 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.IGuiThreadTaskExecutor;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.GroupDefinitionManager;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.RequestFromServerPermissionsService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionStatusDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
|
@ -117,6 +119,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
|||
* May 15, 2013 1040 mpduff Add shared sites.
|
||||
* Jun 04, 2013 223 mpduff Add point data.
|
||||
* Jul 18, 2013 1653 mpduff Add SubscriptionStatusSummary and the display dialog.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -545,126 +548,127 @@ public class CreateSubscriptionDlgPresenter {
|
|||
String currentUser = LocalizationManager.getInstance().getCurrentUser();
|
||||
final String username = user.uniqueId().toString();
|
||||
|
||||
if (this.create) {
|
||||
// Check for permission
|
||||
IPermissionsService permissionsService = DataDeliveryServices
|
||||
.getPermissionsService();
|
||||
boolean autoApprove = false;
|
||||
if (permissionsService instanceof RequestFromServerPermissionsService) {
|
||||
try {
|
||||
boolean autoApprove = DataDeliveryServices
|
||||
.getPermissionsService()
|
||||
// check to see if user is authorized to approve. If so then
|
||||
// auto-approve
|
||||
autoApprove = ((RequestFromServerPermissionsService) permissionsService)
|
||||
.checkPermissionToChangeSubscription(user,
|
||||
PENDING_APPROVAL_MESSAGE, subscription)
|
||||
.isAuthorized();
|
||||
|
||||
setSubscriptionId(subscription);
|
||||
|
||||
if (autoApprove) {
|
||||
final BlockingQueue<SubscriptionStatusSummary> exchanger = new ArrayBlockingQueue<SubscriptionStatusSummary>(
|
||||
1);
|
||||
|
||||
final Shell jobShell = view.getShell();
|
||||
Job job = new Job("Creating Subscription...") {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
DataDeliveryGUIUtils.markBusyInUIThread(jobShell);
|
||||
ISubscriptionServiceResult result = storeSubscription(
|
||||
subscription, username);
|
||||
if (result != null) {
|
||||
if (result.isAllowFurtherEditing()) {
|
||||
return new Status(
|
||||
Status.CANCEL,
|
||||
CreateSubscriptionDlgPresenter.class
|
||||
.getName(), result
|
||||
.getMessageToDisplay());
|
||||
} else {
|
||||
SubscriptionStatusSummary sum = result
|
||||
.getSubscriptionStatusSummary();
|
||||
|
||||
exchanger.add(sum);
|
||||
return new Status(
|
||||
Status.OK,
|
||||
CreateSubscriptionDlgPresenter.class
|
||||
.getName(), result
|
||||
.getMessageToDisplay());
|
||||
}
|
||||
} else {
|
||||
return new Status(Status.ERROR,
|
||||
CreateSubscriptionDlgPresenter.class
|
||||
.getName(),
|
||||
"Error Storing Subscription");
|
||||
}
|
||||
}
|
||||
};
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(final IJobChangeEvent event) {
|
||||
try {
|
||||
final IStatus status = event.getResult();
|
||||
|
||||
final boolean subscriptionCreated = status
|
||||
.isOK();
|
||||
if (subscriptionCreated) {
|
||||
sendSubscriptionNotification(subscription,
|
||||
username);
|
||||
}
|
||||
|
||||
if (!Strings.isNullOrEmpty(status.getMessage())) {
|
||||
guiThreadTaskExecutor
|
||||
.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!view.isDisposed()) {
|
||||
if (subscriptionCreated) {
|
||||
try {
|
||||
displaySummary(
|
||||
exchanger
|
||||
.take(),
|
||||
status.getMessage());
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
view.setStatus(Status.OK);
|
||||
view.closeDlg();
|
||||
} else {
|
||||
view.setStatus(Status.CANCEL);
|
||||
view.displayPopup(
|
||||
"Unable to Create Subscription",
|
||||
status.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
DataDeliveryGUIUtils
|
||||
.markNotBusyInUIThread(jobShell);
|
||||
}
|
||||
}
|
||||
});
|
||||
job.schedule();
|
||||
return false;
|
||||
} else {
|
||||
InitialPendingSubscription pendingSub = subscription
|
||||
.initialPending(currentUser);
|
||||
|
||||
try {
|
||||
handler.store(pendingSub);
|
||||
|
||||
this.subscription = pendingSub;
|
||||
|
||||
subscriptionNotificationService
|
||||
.sendCreatedPendingSubscriptionNotification(
|
||||
pendingSub, username);
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to create pending subscription.", e);
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.create) {
|
||||
setSubscriptionId(subscription);
|
||||
if (autoApprove) {
|
||||
final BlockingQueue<SubscriptionStatusSummary> exchanger = new ArrayBlockingQueue<SubscriptionStatusSummary>(
|
||||
1);
|
||||
|
||||
final Shell jobShell = view.getShell();
|
||||
Job job = new Job("Creating Subscription...") {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
DataDeliveryGUIUtils.markBusyInUIThread(jobShell);
|
||||
ISubscriptionServiceResult result = storeSubscription(
|
||||
subscription, username);
|
||||
if (result != null) {
|
||||
if (result.isAllowFurtherEditing()) {
|
||||
return new Status(Status.CANCEL,
|
||||
CreateSubscriptionDlgPresenter.class
|
||||
.getName(),
|
||||
result.getMessageToDisplay());
|
||||
} else {
|
||||
SubscriptionStatusSummary sum = result
|
||||
.getSubscriptionStatusSummary();
|
||||
|
||||
exchanger.add(sum);
|
||||
return new Status(Status.OK,
|
||||
CreateSubscriptionDlgPresenter.class
|
||||
.getName(),
|
||||
result.getMessageToDisplay());
|
||||
}
|
||||
} else {
|
||||
return new Status(Status.ERROR,
|
||||
CreateSubscriptionDlgPresenter.class
|
||||
.getName(),
|
||||
"Error Storing Subscription");
|
||||
}
|
||||
}
|
||||
};
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(final IJobChangeEvent event) {
|
||||
try {
|
||||
final IStatus status = event.getResult();
|
||||
|
||||
final boolean subscriptionCreated = status.isOK();
|
||||
if (subscriptionCreated) {
|
||||
sendSubscriptionNotification(subscription,
|
||||
username);
|
||||
}
|
||||
|
||||
if (!Strings.isNullOrEmpty(status.getMessage())) {
|
||||
guiThreadTaskExecutor.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!view.isDisposed()) {
|
||||
if (subscriptionCreated) {
|
||||
try {
|
||||
displaySummary(
|
||||
exchanger.take(),
|
||||
status.getMessage());
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
statusHandler.handle(
|
||||
Priority.PROBLEM,
|
||||
e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
view.setStatus(Status.OK);
|
||||
view.closeDlg();
|
||||
} else {
|
||||
view.setStatus(Status.CANCEL);
|
||||
view.displayPopup(
|
||||
"Unable to Create Subscription",
|
||||
status.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
DataDeliveryGUIUtils
|
||||
.markNotBusyInUIThread(jobShell);
|
||||
}
|
||||
}
|
||||
});
|
||||
job.schedule();
|
||||
return false;
|
||||
} else {
|
||||
InitialPendingSubscription pendingSub = subscription
|
||||
.initialPending(currentUser);
|
||||
|
||||
try {
|
||||
handler.store(pendingSub);
|
||||
|
||||
this.subscription = pendingSub;
|
||||
|
||||
subscriptionNotificationService
|
||||
.sendCreatedPendingSubscriptionNotification(
|
||||
pendingSub, username);
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to create pending subscription.", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Check for pending subscription, can only have one pending change
|
||||
PendingSubscription pendingSub = subscription
|
||||
|
@ -692,61 +696,47 @@ public class CreateSubscriptionDlgPresenter {
|
|||
return false;
|
||||
}
|
||||
|
||||
// check to see if user is authorized to approve. If so then
|
||||
// auto-approve
|
||||
try {
|
||||
boolean autoApprove = DataDeliveryServices
|
||||
.getPermissionsService()
|
||||
.checkPermissionToChangeSubscription(user,
|
||||
PENDING_APPROVAL_MESSAGE, subscription)
|
||||
.isAuthorized();
|
||||
|
||||
if (autoApprove) {
|
||||
try {
|
||||
final ISubscriptionServiceResult response = subscriptionService
|
||||
.update(subscription,
|
||||
new CancelForceApplyAndIncreaseLatencyDisplayText(
|
||||
"update", view.getShell()));
|
||||
if (response.hasMessageToDisplay()) {
|
||||
view.displayPopup(UPDATED_TITLE,
|
||||
response.getMessageToDisplay());
|
||||
}
|
||||
|
||||
// If there was a force apply prompt, and the user
|
||||
// selects no, then we want to allow them to
|
||||
// continue editing the subscription
|
||||
if (response.isAllowFurtherEditing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
subscriptionNotificationService
|
||||
.sendUpdatedSubscriptionNotification(
|
||||
subscription, username);
|
||||
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to update subscription.", e);
|
||||
if (autoApprove) {
|
||||
try {
|
||||
final ISubscriptionServiceResult response = subscriptionService
|
||||
.update(subscription,
|
||||
new CancelForceApplyAndIncreaseLatencyDisplayText(
|
||||
"update", view.getShell()));
|
||||
if (response.hasMessageToDisplay()) {
|
||||
view.displayPopup(UPDATED_TITLE,
|
||||
response.getMessageToDisplay());
|
||||
}
|
||||
} else {
|
||||
setSubscriptionId(subscription);
|
||||
try {
|
||||
pendingSubHandler.update(pendingSub);
|
||||
|
||||
subscriptionNotificationService
|
||||
.sendCreatedPendingSubscriptionForSubscriptionNotification(
|
||||
pendingSub, username);
|
||||
|
||||
final String msg = PENDING_APPROVAL_MESSAGE;
|
||||
view.displayPopup("Subscription Pending", msg);
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to create pending subscription.", e);
|
||||
// If there was a force apply prompt, and the user
|
||||
// selects no, then we want to allow them to
|
||||
// continue editing the subscription
|
||||
if (response.isAllowFurtherEditing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
subscriptionNotificationService
|
||||
.sendUpdatedSubscriptionNotification(subscription,
|
||||
username);
|
||||
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to update subscription.", e);
|
||||
}
|
||||
} else {
|
||||
setSubscriptionId(subscription);
|
||||
try {
|
||||
pendingSubHandler.update(pendingSub);
|
||||
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
subscriptionNotificationService
|
||||
.sendCreatedPendingSubscriptionForSubscriptionNotification(
|
||||
pendingSub, username);
|
||||
|
||||
final String msg = PENDING_APPROVAL_MESSAGE;
|
||||
view.displayPopup("Subscription Pending", msg);
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to create pending subscription.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ import org.eclipse.swt.widgets.Button;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
|
||||
|
@ -50,6 +50,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 17, 2013 2000 djohnson Consolidate duplicate code from latency and priority versions.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -129,8 +130,8 @@ public abstract class SystemRulesTab extends SystemTab {
|
|||
gd.widthHint = 375;
|
||||
gd.heightHint = 200;
|
||||
|
||||
rulesList = new List(listComp, SWT.BORDER | SWT.MULTI
|
||||
| SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
|
||||
rulesList = new List(listComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL | SWT.SINGLE);
|
||||
rulesList.setLayoutData(gd);
|
||||
rulesList.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -237,7 +238,8 @@ public abstract class SystemRulesTab extends SystemTab {
|
|||
* New/Edit rule action handler.
|
||||
*/
|
||||
private void handleRule() {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE;
|
||||
final String permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId() + notAuthorizedMsg + permission;
|
||||
|
||||
|
@ -278,7 +280,7 @@ public abstract class SystemRulesTab extends SystemTab {
|
|||
}
|
||||
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred in authorization request", e);
|
||||
}
|
||||
|
@ -288,7 +290,8 @@ public abstract class SystemRulesTab extends SystemTab {
|
|||
* Delete rule action handler.
|
||||
*/
|
||||
private void handleDeleteRule() {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE;
|
||||
final String permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE
|
||||
.toString();
|
||||
IUser user = UserController.getUserObject();
|
||||
String msg = user.uniqueId() + notAuthorizedMsg + permission;
|
||||
|
||||
|
@ -317,7 +320,7 @@ public abstract class SystemRulesTab extends SystemTab {
|
|||
return;
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
} catch (AuthException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred in authorization request", e);
|
||||
}
|
||||
|
|
|
@ -40,13 +40,10 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.common.util.SizeUtil;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerRowData;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.approve.SubscriptionApprovalRowData;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -79,6 +76,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jun 04, 2013 223 mpduff Add point data stuff.
|
||||
* Jun 11, 2013 2064 mpduff Don't output Parameter header if none exist.
|
||||
* Jun 12, 2013 2064 mpduff Use SizeUtil to format data size output.
|
||||
* Jul 26, 2031 2232 mpduff Removed sendAuthorizationRequest method.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -742,20 +740,6 @@ public class DataDeliveryUtils {
|
|||
return StringUtil.getIndentedList(list, " ");
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an authorization request
|
||||
*
|
||||
* @param request
|
||||
* The request object
|
||||
* @return DataDeliveryAuthReqeust object
|
||||
* @throws VizException
|
||||
*/
|
||||
public static DataDeliveryAuthRequest sendAuthorizationRequest(
|
||||
DataDeliveryAuthRequest request) throws VizException {
|
||||
return (DataDeliveryAuthRequest) ThriftClient
|
||||
.sendPrivilegedRequest(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum latency for the provided subscription. Calculated as the
|
||||
* maximum cyclic difference.
|
||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* May 23, 2012 mpduff Initial creation
|
||||
* Aug 08, 2012 863 jpiatt Added new interface method.
|
||||
* Jul 28, 2013 2236 mpduff Made resizable.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,7 +62,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
*/
|
||||
|
||||
public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
||||
|
||||
|
||||
/** The Stack Layout. */
|
||||
private final StackLayout stackLayout = new StackLayout();
|
||||
|
||||
|
@ -79,26 +80,31 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
|
||||
/** Permissions dual list */
|
||||
private DualList permDualList;
|
||||
|
||||
|
||||
/** User role dual list */
|
||||
private DualList userRoleDualList;
|
||||
|
||||
|
||||
/** Stack composite */
|
||||
private Composite stackComp;
|
||||
|
||||
/** The application currently selected.*/
|
||||
/** The application currently selected. */
|
||||
private final String application;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent parent shell
|
||||
* @param type type of data being edited
|
||||
* @param selection selection being passed in
|
||||
* @param application application working on
|
||||
* @param parent
|
||||
* parent shell
|
||||
* @param type
|
||||
* type of data being edited
|
||||
* @param selection
|
||||
* selection being passed in
|
||||
* @param application
|
||||
* application working on
|
||||
*/
|
||||
public ManageUserDlg(Shell parent, String type, String selection, String application) {
|
||||
super(parent, SWT.DIALOG_TRIM);
|
||||
public ManageUserDlg(Shell parent, String type, String selection,
|
||||
String application) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
|
||||
this.selection = selection;
|
||||
this.type = type;
|
||||
this.application = application;
|
||||
|
@ -137,33 +143,39 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
|
||||
String[] entries;
|
||||
if (type.equalsIgnoreCase("Role")) {
|
||||
entries = new String[] { "Assigned Roles", "Assigned Permissions", "Assign Role to Users" };
|
||||
entries = new String[] { "Assigned Roles", "Assigned Permissions",
|
||||
"Assign Role to Users" };
|
||||
} else {
|
||||
entries = new String[] { "Assigned Roles", "Assigned Permissions" };
|
||||
}
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
editCbo = new Combo(labelComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
editCbo.setLayoutData(gd);
|
||||
|
||||
|
||||
editCbo.setItems(entries);
|
||||
editCbo.select(0);
|
||||
editCbo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (editCbo.getItem(editCbo.getSelectionIndex()).equals("Assigned Roles")) {
|
||||
if (editCbo.getItem(editCbo.getSelectionIndex()).equals(
|
||||
"Assigned Roles")) {
|
||||
stackLayout.topControl = roleDualList;
|
||||
} else if (editCbo.getItem(editCbo.getSelectionIndex()).equals("Assigned Permissions")) {
|
||||
} else if (editCbo.getItem(editCbo.getSelectionIndex()).equals(
|
||||
"Assigned Permissions")) {
|
||||
stackLayout.topControl = permDualList;
|
||||
} else if (editCbo.getItem(editCbo.getSelectionIndex()).equals("Assign Role to Users")) {
|
||||
} else if (editCbo.getItem(editCbo.getSelectionIndex()).equals(
|
||||
"Assign Role to Users")) {
|
||||
stackLayout.topControl = userRoleDualList;
|
||||
}
|
||||
|
||||
|
||||
stackComp.layout();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
stackComp = new Composite(shell, SWT.NONE);
|
||||
stackComp.setLayout(stackLayout);
|
||||
stackComp.setLayoutData(gd);
|
||||
|
||||
NwsRoleDataManager manager = NwsRoleDataManager.getInstance();
|
||||
ArrayList<String> selectedList = new ArrayList<String>();
|
||||
|
@ -172,7 +184,8 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
String selectedLabel = "Selected Roles:";
|
||||
|
||||
// build roles widgets
|
||||
String[] userRoles = manager.getRoleData(application).getUserRoles(this.selection);
|
||||
String[] userRoles = manager.getRoleData(application).getUserRoles(
|
||||
this.selection);
|
||||
for (String role : userRoles) {
|
||||
selectedList.add(role);
|
||||
}
|
||||
|
@ -181,7 +194,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
for (String role : roles) {
|
||||
fullList.add(role);
|
||||
}
|
||||
|
||||
|
||||
DualListMenuData menuData = new DualListMenuData();
|
||||
menuData.setApplication(this.application);
|
||||
menuData.setMenuText("Details...");
|
||||
|
@ -201,7 +214,8 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
// Build permissions widgets
|
||||
ArrayList<String> selectedPermList = new ArrayList<String>();
|
||||
ArrayList<String> fullPermList = new ArrayList<String>();
|
||||
String[] userPerms = manager.getRoleData(application).getUserPermissions(this.selection);
|
||||
String[] userPerms = manager.getRoleData(application)
|
||||
.getUserPermissions(this.selection);
|
||||
for (String perm : userPerms) {
|
||||
selectedPermList.add(perm);
|
||||
}
|
||||
|
@ -245,9 +259,10 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
userRoleConfig.setListHeight(90);
|
||||
userRoleConfig.setListWidth(175);
|
||||
userRoleConfig.setFullList(fullUserList);
|
||||
|
||||
userRoleDualList = new DualList(stackComp, SWT.NONE, userRoleConfig, this);
|
||||
|
||||
|
||||
userRoleDualList = new DualList(stackComp, SWT.NONE, userRoleConfig,
|
||||
this);
|
||||
|
||||
int buttonWidth = 75;
|
||||
GridData btnData = new GridData(buttonWidth, SWT.DEFAULT);
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||
|
@ -290,54 +305,56 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
String[] selectedUsers = userRoleDualList.getSelectedListItems();
|
||||
String[] permissions = permDualList.getSelectedListItems();
|
||||
String[] roles = roleDualList.getSelectedListItems();
|
||||
|
||||
|
||||
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
|
||||
NwsRoleData roleData = man.getRoleData(application);
|
||||
|
||||
|
||||
if (type.equalsIgnoreCase("User")) {
|
||||
ArrayList<UserXML> userList = (ArrayList<UserXML>) roleData.getUserList();
|
||||
for (UserXML user: userList) {
|
||||
ArrayList<UserXML> userList = (ArrayList<UserXML>) roleData
|
||||
.getUserList();
|
||||
for (UserXML user : userList) {
|
||||
if (user.getUserId().equals(selection)) {
|
||||
// Update permissions
|
||||
ArrayList<String> permissionList = new ArrayList<String>();
|
||||
for (String perm: permissions) {
|
||||
for (String perm : permissions) {
|
||||
permissionList.add(perm);
|
||||
}
|
||||
user.setPermissionList(permissionList);
|
||||
|
||||
|
||||
// Update roles
|
||||
ArrayList<String> roleList = new ArrayList<String>();
|
||||
for (String role: roles) {
|
||||
for (String role : roles) {
|
||||
roleList.add(role);
|
||||
}
|
||||
user.setRoleList(roleList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // type is role
|
||||
ArrayList<RoleXML> roleList = (ArrayList<RoleXML>) roleData.getRoleList();
|
||||
for (RoleXML role: roleList) {
|
||||
ArrayList<RoleXML> roleList = (ArrayList<RoleXML>) roleData
|
||||
.getRoleList();
|
||||
for (RoleXML role : roleList) {
|
||||
if (role.getRoleId().equals(selection)) {
|
||||
// Update permissions, start by clearing the list
|
||||
role.getPermissionList().clear();
|
||||
for (String perm: permissions) {
|
||||
for (String perm : permissions) {
|
||||
if (!role.getPermissionList().contains(perm)) {
|
||||
role.addPermission(perm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add roles
|
||||
for (String r: roles) {
|
||||
for (String r : roles) {
|
||||
if (!role.getPermissionList().contains(r)) {
|
||||
role.addPermission(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add role to selected users
|
||||
for (String selectedUser: selectedUsers) {
|
||||
for (UserXML user: roleData.getUserList()) {
|
||||
for (String selectedUser : selectedUsers) {
|
||||
for (UserXML user : roleData.getUserList()) {
|
||||
if (selectedUser.equals(user.getUserId())) {
|
||||
if (!user.getRoleList().contains(selection)) {
|
||||
user.addRole(selection);
|
||||
|
@ -347,10 +364,10 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void hasEntries(boolean entries) {
|
||||
this.setReturnValue(true);
|
||||
|
@ -359,6 +376,6 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
@Override
|
||||
public void selectionChanged() {
|
||||
// unused
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.raytheon.uf.common.serialization.ExceptionWrapper;
|
|||
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* Send requests to a privileged service on the server.
|
||||
|
@ -40,6 +41,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 23, 2013 1643 djohnson Initial creation.
|
||||
* May 20, 2013 1040 mpduff Add check for UserNotAuthorized.
|
||||
* Jul 26, 2031 2232 mpduff Improve handling of UserNotAuthorized.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -73,7 +75,13 @@ public class BasePrivilegedServerService<T extends AbstractPrivilegedRequest>
|
|||
.unwrapThrowable(((ServerErrorResponse) object)
|
||||
.getException()));
|
||||
} else if (object instanceof UserNotAuthorized) {
|
||||
return null;
|
||||
UserNotAuthorized na = (UserNotAuthorized) object;
|
||||
|
||||
// Display the not authorized message here, NwsNotAuthHandler cannot
|
||||
// be accessed from here
|
||||
UFStatus.getHandler(UserNotAuthorized.class).handle(
|
||||
Priority.PROBLEM, na.getMessage());
|
||||
return super.unwrapResponse(responseType, na.getRequest());
|
||||
} else {
|
||||
statusHandler
|
||||
.warn(String
|
||||
|
|
|
@ -17,12 +17,10 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||
package com.raytheon.uf.common.auth.req;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Interface that defines the service to work with permissions.
|
||||
|
@ -34,6 +32,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 04, 2013 1441 djohnson Initial creation
|
||||
* Jul 26, 2031 2232 mpduff Moved to common.auth.req.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,26 +59,9 @@ public interface IPermissionsService {
|
|||
* the permission
|
||||
* @return true if the user had the specific permission
|
||||
*/
|
||||
boolean hasPermission(DataDeliveryPermission permission);
|
||||
boolean hasPermission(String permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a user has the permissions to change a subscription.
|
||||
*
|
||||
* @param user
|
||||
* the user requesting to change the subscription
|
||||
* @param notAuthorizedMessage
|
||||
* the message that should be displayed if they are not
|
||||
* authorized
|
||||
* @param subscription
|
||||
* the subscription they are attempting to change
|
||||
* @return the response
|
||||
* @throws VizException
|
||||
*/
|
||||
public IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
|
||||
final IUser user, String notAuthorizedMessage,
|
||||
final Subscription subscription) throws VizException;
|
||||
|
||||
/**
|
||||
* Check whether a user has the specified permissions.
|
||||
*
|
||||
|
@ -91,12 +73,12 @@ public interface IPermissionsService {
|
|||
* @param permission
|
||||
* the permission to check
|
||||
* @return IAuthorizedPermissionResponse the response
|
||||
* @throws VizException
|
||||
* @throws AuthException
|
||||
* on error checking permissions
|
||||
*/
|
||||
public IAuthorizedPermissionResponse checkPermission(IUser user,
|
||||
String notAuthorizedMessage, DataDeliveryPermission permission)
|
||||
throws VizException;
|
||||
String notAuthorizedMessage, String permission)
|
||||
throws AuthException;
|
||||
|
||||
/**
|
||||
* Check whether a user has one of the specified permissions.
|
||||
|
@ -109,10 +91,10 @@ public interface IPermissionsService {
|
|||
* @param permissions
|
||||
* the permissions to check
|
||||
* @return IAuthorizedPermissionResponse the response
|
||||
* @throws VizException
|
||||
* @throws AuthException
|
||||
* on error checking permissions
|
||||
*/
|
||||
public IAuthorizedPermissionResponse checkPermissions(IUser user,
|
||||
String notAuthorizedMessage, DataDeliveryPermission... permissions)
|
||||
throws VizException;
|
||||
String notAuthorizedMessage, String... permissions)
|
||||
throws AuthException;
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.auth.user;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
|
||||
/**
|
||||
* A permission.
|
||||
*
|
||||
|
@ -28,7 +30,8 @@ package com.raytheon.uf.common.auth.user;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 5, 2012 1302 djohnson Initial creation
|
||||
* Nov 05, 2012 1302 djohnson Initial creation
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -36,7 +39,7 @@ package com.raytheon.uf.common.auth.user;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IPermission {
|
||||
public interface IPermission extends ISerializableObject {
|
||||
|
||||
/**
|
||||
* Get the description.
|
||||
|
@ -46,10 +49,9 @@ public interface IPermission {
|
|||
String getDescription();
|
||||
|
||||
/**
|
||||
* The display name of the permission.
|
||||
* Get the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
@Override
|
||||
String toString();
|
||||
String getName();
|
||||
}
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.request;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermissionsContainer.DataDeliveryPermissionsContainerTypeAdapter;
|
||||
import com.raytheon.uf.common.serialization.IDeserializationContext;
|
||||
import com.raytheon.uf.common.serialization.ISerializationContext;
|
||||
import com.raytheon.uf.common.serialization.ISerializationTypeAdapter;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdapter;
|
||||
|
||||
/**
|
||||
* Used to hide direct access to permission collections in
|
||||
* {@link DataDeliveryAuthRequest} from client-code.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 3, 2012 1241 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerializeTypeAdapter(factory = DataDeliveryPermissionsContainerTypeAdapter.class)
|
||||
public class DataDeliveryPermissionsContainer {
|
||||
|
||||
public static class DataDeliveryPermissionsContainerTypeAdapter implements
|
||||
ISerializationTypeAdapter<DataDeliveryPermissionsContainer> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void serialize(ISerializationContext serializer,
|
||||
DataDeliveryPermissionsContainer object)
|
||||
throws SerializationException {
|
||||
serializer.writeObject(object.authorizedList);
|
||||
serializer.writeObject(object.requestList);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public DataDeliveryPermissionsContainer deserialize(
|
||||
IDeserializationContext deserializer)
|
||||
throws SerializationException {
|
||||
DataDeliveryPermissionsContainer container = new DataDeliveryPermissionsContainer();
|
||||
container.authorizedList
|
||||
.addAll((List<DataDeliveryPermission>) deserializer
|
||||
.readObject());
|
||||
container.requestList
|
||||
.addAll((List<DataDeliveryPermission>) deserializer
|
||||
.readObject());
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* List of permissions to check.
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private final List<DataDeliveryPermission> requestList = new ArrayList<DataDeliveryPermission>();
|
||||
|
||||
/**
|
||||
* List of permissions that were authorized.
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private final List<DataDeliveryPermission> authorizedList = new ArrayList<DataDeliveryPermission>();
|
||||
|
||||
/**
|
||||
* @param permission
|
||||
*/
|
||||
public void addRequestedPermission(DataDeliveryPermission permission) {
|
||||
requestList.add(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permission
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(DataDeliveryPermission permission) {
|
||||
return authorizedList.contains(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permission
|
||||
*/
|
||||
public void addAuthorized(DataDeliveryPermission permission) {
|
||||
this.authorizedList.add(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public List<DataDeliveryPermission> getRequestedPermissions() {
|
||||
return requestList;
|
||||
}
|
||||
}
|
|
@ -17,17 +17,22 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.request;
|
||||
package com.raytheon.uf.common.plugin.nwsauth;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElements;
|
||||
|
||||
import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService.IAuthorizedPermissionResponse;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Authorization request for data delivery.
|
||||
* Nws Authorization Request object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -35,8 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 12, 2012 mpduff Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2013 2232 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -44,7 +48,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class DataDeliveryAuthRequest extends AbstractPrivilegedRequest implements ISerializableObject {
|
||||
public class NwsAuthRequest extends AbstractPrivilegedRequest implements
|
||||
ISerializableObject, IAuthorizedPermissionResponse {
|
||||
|
||||
/**
|
||||
* Authorized flag, true if authorized.
|
||||
|
@ -58,20 +63,31 @@ public class DataDeliveryAuthRequest extends AbstractPrivilegedRequest implement
|
|||
@DynamicSerializeElement
|
||||
private String notAuthorizedMessage = "Not Authorized";
|
||||
|
||||
/**
|
||||
* List of requested permissions.
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private DataDeliveryPermissionsContainer permissionsContainer = new DataDeliveryPermissionsContainer();
|
||||
@XmlElements({ @XmlElement(type = String.class) })
|
||||
private List<String> requestList = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* List of permissions that were authorized.
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
@XmlElements({ @XmlElement(type = String.class) })
|
||||
private List<String> authorizedList = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DataDeliveryAuthRequest() {
|
||||
public NwsAuthRequest() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the authorized
|
||||
*/
|
||||
@Override
|
||||
public boolean isAuthorized() {
|
||||
return authorized;
|
||||
}
|
||||
|
@ -103,8 +119,8 @@ public class DataDeliveryAuthRequest extends AbstractPrivilegedRequest implement
|
|||
* @param permission
|
||||
* Authorized permission
|
||||
*/
|
||||
public void addAuthorized(DataDeliveryPermission permission) {
|
||||
this.permissionsContainer.addAuthorized(permission);
|
||||
public void addAuthorized(String permission) {
|
||||
this.authorizedList.add(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,8 +129,8 @@ public class DataDeliveryAuthRequest extends AbstractPrivilegedRequest implement
|
|||
*
|
||||
* @param permission
|
||||
*/
|
||||
public void addRequestedPermissions(DataDeliveryPermission permission) {
|
||||
addRequestedPermissions(new DataDeliveryPermission[] { permission });
|
||||
public void addRequestedPermissions(String permission) {
|
||||
this.addRequestedPermissions(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,11 +138,11 @@ public class DataDeliveryAuthRequest extends AbstractPrivilegedRequest implement
|
|||
*
|
||||
* @param permissions
|
||||
*/
|
||||
public void addRequestedPermissions(DataDeliveryPermission... permissions) {
|
||||
for (DataDeliveryPermission permission : permissions) {
|
||||
permissionsContainer.addRequestedPermission(permission);
|
||||
public void addRequestedPermissions(String... permissions) {
|
||||
for (String permission : permissions) {
|
||||
this.requestList.add(permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the authorizations allowed for this user contain a
|
||||
|
@ -136,38 +152,52 @@ public class DataDeliveryAuthRequest extends AbstractPrivilegedRequest implement
|
|||
* the permission to check for
|
||||
* @return true if the authorized list contains the permission
|
||||
*/
|
||||
public boolean isAuthorized(DataDeliveryPermission permission) {
|
||||
return permissionsContainer.contains(permission);
|
||||
public boolean isAuthorized(String permission) {
|
||||
return this.authorizedList.contains(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return the requestList
|
||||
*/
|
||||
public List<DataDeliveryPermission> getRequestedPermissions() {
|
||||
return permissionsContainer.getRequestedPermissions();
|
||||
public List<String> getRequestedPermissions() {
|
||||
return this.requestList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added only to comply with dynamic serialization. DO NOT USE.
|
||||
*
|
||||
* @return the permissionsContainer
|
||||
* @deprecated added only to comply with dynamic serialization
|
||||
* @return the requestList
|
||||
*/
|
||||
@Deprecated
|
||||
public DataDeliveryPermissionsContainer getPermissionsContainer() {
|
||||
return permissionsContainer;
|
||||
public List<String> getRequestList() {
|
||||
return requestList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added only to comply with dynamic serialization. DO NOT USE.
|
||||
*
|
||||
* @param permissionsContainer
|
||||
* the permissionsContainer to set
|
||||
* @deprecated added only to comply with dynamic serialization
|
||||
* @return the authorizedList
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPermissionsContainer(
|
||||
DataDeliveryPermissionsContainer permissionsContainer) {
|
||||
this.permissionsContainer = permissionsContainer;
|
||||
public List<String> getAuthorizedList() {
|
||||
return authorizedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestList
|
||||
* the requestList to set
|
||||
*/
|
||||
public void setRequestList(List<String> requestList) {
|
||||
this.requestList = requestList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param authorizedList
|
||||
* the authorizedList to set
|
||||
*/
|
||||
public void setAuthorizedList(List<String> authorizedList) {
|
||||
this.authorizedList = authorizedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return isAuthorized();
|
||||
}
|
||||
}
|
|
@ -30,7 +30,8 @@ import com.raytheon.uf.common.auth.user.IPermission;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 5, 2012 1302 djohnson Initial creation
|
||||
* Nov 05, 2012 1302 djohnson Initial creation
|
||||
* Jul 26, 2031 2232 mpduff Renamed toString to getName.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -40,8 +41,10 @@ import com.raytheon.uf.common.auth.user.IPermission;
|
|||
|
||||
public class NwsPermission implements IPermission {
|
||||
|
||||
/** Permission description */
|
||||
private final String description;
|
||||
|
||||
/** Permission name */
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
|
@ -61,9 +64,11 @@ public class NwsPermission implements IPermission {
|
|||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ Require-Bundle: com.raytheon.uf.common.auth;bundle-version="1.12.1174",
|
|||
com.raytheon.uf.common.datadelivery.event;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0",
|
||||
org.springframework;bundle-version="2.5.6",
|
||||
com.raytheon.uf.edex.datadelivery.retrieval;bundle-version="1.0.0"
|
||||
com.raytheon.uf.edex.datadelivery.retrieval;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.plugin.nwsauth;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.plugin.nwsauth;bundle-version="1.12.1174"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class="com.raytheon.uf.edex.datadelivery.service.services.DataDeliveryPrivilegedRequestHandler" />
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg
|
||||
value="com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest" />
|
||||
value="com.raytheon.uf.common.plugin.nwsauth.NwsAuthRequest" />
|
||||
<constructor-arg ref="datadeliveryAuthorization" />
|
||||
</bean>
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ package com.raytheon.uf.edex.datadelivery.service.services;
|
|||
import com.raytheon.uf.common.auth.exception.AuthorizationException;
|
||||
import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.plugin.nwsauth.NwsAuthRequest;
|
||||
import com.raytheon.uf.edex.auth.AuthManager;
|
||||
import com.raytheon.uf.edex.auth.AuthManagerFactory;
|
||||
import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler;
|
||||
|
@ -39,8 +39,9 @@ import com.raytheon.uf.edex.auth.roles.IRoleStorage;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 12, 2012 224 mpduff Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Apr 12, 2012 224 mpduff Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,8 +49,8 @@ import com.raytheon.uf.edex.auth.roles.IRoleStorage;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DataDeliveryPrivilegedRequestHandler<T extends AbstractPrivilegedRequest> extends
|
||||
AbstractPrivilegedRequestHandler<T> {
|
||||
public class DataDeliveryPrivilegedRequestHandler<T extends AbstractPrivilegedRequest>
|
||||
extends AbstractPrivilegedRequestHandler<T> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -62,33 +63,32 @@ public class DataDeliveryPrivilegedRequestHandler<T extends AbstractPrivilegedRe
|
|||
@Override
|
||||
public AuthorizationResponse authorized(IUser user, T request)
|
||||
throws AuthorizationException {
|
||||
if (request instanceof DataDeliveryAuthRequest) {
|
||||
DataDeliveryAuthRequest dataDeliveryRequest = (DataDeliveryAuthRequest) request;
|
||||
if (request instanceof NwsAuthRequest) {
|
||||
NwsAuthRequest authRequest = (NwsAuthRequest) request;
|
||||
|
||||
AuthManager manager = AuthManagerFactory.getInstance().getManager();
|
||||
IRoleStorage roles = manager.getRoleStorage();
|
||||
|
||||
|
||||
boolean addedAuthorization = false;
|
||||
|
||||
for (DataDeliveryPermission permission : dataDeliveryRequest
|
||||
.getRequestedPermissions()) {
|
||||
boolean authorized = roles.isAuthorized(permission.toString(), user
|
||||
.uniqueId().toString(),
|
||||
"Data Delivery");
|
||||
|
||||
for (String permission : authRequest.getRequestedPermissions()) {
|
||||
boolean authorized = roles.isAuthorized(permission.toString(),
|
||||
user.uniqueId().toString(), "Data Delivery");
|
||||
addedAuthorization |= authorized;
|
||||
|
||||
if (authorized) {
|
||||
dataDeliveryRequest.addAuthorized(permission);
|
||||
authRequest.addAuthorized(permission);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (addedAuthorization) {
|
||||
return new AuthorizationResponse(true);
|
||||
}
|
||||
|
||||
return new AuthorizationResponse(dataDeliveryRequest.getNotAuthorizedMessage());
|
||||
|
||||
return new AuthorizationResponse(
|
||||
authRequest.getNotAuthorizedMessage());
|
||||
}
|
||||
|
||||
|
||||
return new AuthorizationResponse(false);
|
||||
}
|
||||
|
||||
|
@ -101,13 +101,16 @@ public class DataDeliveryPrivilegedRequestHandler<T extends AbstractPrivilegedRe
|
|||
*/
|
||||
@Override
|
||||
public Object handleRequest(T request) throws Exception {
|
||||
// We are only looking for authorized or not and don't have any work to do here
|
||||
// If we get here then we are authorized, set true in request object and return it
|
||||
if (request instanceof DataDeliveryAuthRequest) {
|
||||
DataDeliveryAuthRequest r = (DataDeliveryAuthRequest) request;
|
||||
/*
|
||||
* We are only looking for authorized or not and don't have any work to
|
||||
* do here. If we get here then we are authorized, set true in request
|
||||
* object and return it
|
||||
*/
|
||||
if (request instanceof NwsAuthRequest) {
|
||||
NwsAuthRequest r = (NwsAuthRequest) request;
|
||||
r.setAuthorized(true);
|
||||
}
|
||||
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ import com.raytheon.uf.edex.auth.RemoteRequestRouteWrapper;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/3/2013 1948 bphillip Initial implementation
|
||||
* 7/26/2031 2232 mpduff Don't override executeThrift.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -48,11 +50,6 @@ public class RegistryRemoteRequestWrapper extends RemoteRequestRouteWrapper
|
|||
|
||||
@Override
|
||||
public byte[] request(byte[] data) {
|
||||
return executeThrift(data);
|
||||
return executeThrift(new ByteArrayInputStream(data));
|
||||
}
|
||||
|
||||
public byte[] executeThrift(byte[] data) {
|
||||
return super.executeThrift(new ByteArrayInputStream(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.junit.Before;
|
|||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
|
@ -77,6 +78,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA
|
|||
* Nov 20, 2012 1286 djohnson Rewrite to support proposing subscription stores/updates and force applying.
|
||||
* Jan 02, 2012 1345 djohnson Fix broken tests from using VizApp to move work off the UI thread.
|
||||
* May 08, 2000 2013 djohnson Allow checks for duplicate subscriptions.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -112,7 +114,7 @@ public abstract class AbstractSubscriptionServiceTest {
|
|||
|
||||
final IBandwidthService mockBandwidthService = mock(IBandwidthService.class);
|
||||
|
||||
final IPermissionsService permissionsService = mock(IPermissionsService.class);
|
||||
final IPermissionsService permissionsService = mock(RequestFromServerPermissionsService.class);
|
||||
|
||||
final ISubscriptionOverlapService subscriptionOverlapService = mock(ISubscriptionOverlapService.class);
|
||||
|
||||
|
@ -351,6 +353,7 @@ public abstract class AbstractSubscriptionServiceTest {
|
|||
throws RegistryHandlerException {
|
||||
// Not valid for adhocs
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the only interactions with the subscription handler are to
|
||||
* check for duplicate/overlapping subscriptions.
|
||||
|
@ -506,4 +509,3 @@ public abstract class AbstractSubscriptionServiceTest {
|
|||
*/
|
||||
abstract ForceApplyPromptConfiguration getExpectedForceApplyPromptConfiguration();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,18 +35,18 @@ import java.util.Collections;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.auth.AuthException;
|
||||
import com.raytheon.uf.common.auth.req.IPermissionsService.IAuthorizedPermissionResponse;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService.IAuthorizedPermissionResponse;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
|
||||
/**
|
||||
|
@ -61,6 +61,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubsc
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 21, 2012 1286 djohnson Initial creation
|
||||
* May 08, 2000 2013 djohnson Allow checks for duplicate subscriptions.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -73,7 +74,7 @@ public class SubscriptionServiceMassUpdateTest extends
|
|||
private final IAuthorizedPermissionResponse authorizedPermissionsResponse = mock(IAuthorizedPermissionResponse.class);
|
||||
|
||||
@Before
|
||||
public void setUpPermissionsResponse() throws VizException {
|
||||
public void setUpPermissionsResponse() throws VizException, AuthException {
|
||||
userHasAllPermissions();
|
||||
}
|
||||
|
||||
|
@ -145,7 +146,7 @@ public class SubscriptionServiceMassUpdateTest extends
|
|||
|
||||
@Test
|
||||
public void testUpdateWithPendingCheckNotifiesOfPendingSubscriptionsCreated()
|
||||
throws RegistryHandlerException, VizException {
|
||||
throws RegistryHandlerException, VizException, AuthException {
|
||||
RegistryObjectHandlersUtil.initMocks();
|
||||
|
||||
returnZeroSubscriptionNamesWhenProposeScheduleCalled();
|
||||
|
@ -182,12 +183,13 @@ public class SubscriptionServiceMassUpdateTest extends
|
|||
* @param subscription
|
||||
* the subscription
|
||||
* @throws VizException
|
||||
* @throws AuthException
|
||||
*/
|
||||
private void subscriptionCantBeChangedByUser(Subscription subscription)
|
||||
throws VizException {
|
||||
throws VizException, AuthException {
|
||||
IAuthorizedPermissionResponse noPermission = mock(IAuthorizedPermissionResponse.class);
|
||||
when(
|
||||
permissionsService
|
||||
((RequestFromServerPermissionsService) permissionsService)
|
||||
.checkPermissionToChangeSubscription(any(IUser.class),
|
||||
any(String.class), same(subscription)))
|
||||
.thenReturn(noPermission);
|
||||
|
@ -313,18 +315,19 @@ public class SubscriptionServiceMassUpdateTest extends
|
|||
return null;
|
||||
}
|
||||
|
||||
private void userHasAllPermissions() throws VizException {
|
||||
private void userHasAllPermissions() throws VizException, AuthException {
|
||||
when(
|
||||
permissionsService.checkPermission(any(IUser.class),
|
||||
anyString(), any(DataDeliveryPermission.class)))
|
||||
.thenReturn(authorizedPermissionsResponse);
|
||||
anyString(), any(String.class))).thenReturn(
|
||||
authorizedPermissionsResponse);
|
||||
when(
|
||||
permissionsService.checkPermissions(any(IUser.class),
|
||||
anyString(), any(DataDeliveryPermission.class)))
|
||||
.thenReturn(authorizedPermissionsResponse);
|
||||
anyString(), any(String.class))).thenReturn(
|
||||
authorizedPermissionsResponse);
|
||||
when(
|
||||
permissionsService.checkPermissionToChangeSubscription(
|
||||
any(IUser.class), anyString(), any(Subscription.class)))
|
||||
((RequestFromServerPermissionsService) permissionsService)
|
||||
.checkPermissionToChangeSubscription(any(IUser.class),
|
||||
anyString(), any(Subscription.class)))
|
||||
.thenReturn(authorizedPermissionsResponse);
|
||||
when(authorizedPermissionsResponse.isAuthorized()).thenReturn(true);
|
||||
}
|
||||
|
@ -352,8 +355,7 @@ public class SubscriptionServiceMassUpdateTest extends
|
|||
getExpectedForceApplyMessage(),
|
||||
IProposeScheduleResponse.VALUE_NOT_SET,
|
||||
IProposeScheduleResponse.VALUE_NOT_SET,
|
||||
IProposeScheduleResponse.VALUE_NOT_SET,
|
||||
mockPromptDisplayText,
|
||||
IProposeScheduleResponse.VALUE_NOT_SET, mockPromptDisplayText,
|
||||
getExpectedDisplayForceApplyPromptSubscription(),
|
||||
subNameResults);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue