Issue #1848 - Don't show create shared subscription denied message on create sub when user doesn't have the create shared sub permission

Fix for cave startup

Change-Id: Ic5040a0bf89273669cc450370c4d858072df0dd8

Former-commit-id: 43a3349eda74743ccbccbef2e04bf80a54beba24
This commit is contained in:
Mike Duff 2013-08-21 11:53:05 -05:00
parent d7031d9c76
commit 77e2d04073
3 changed files with 27 additions and 10 deletions

View file

@ -100,4 +100,10 @@
install-size="0"
version="0.0.0"/>
<plugin
id="com.sun.xml.bind"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -101,7 +101,8 @@ 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.
* Jul 26, 2013 2232 mpduff Refactored Data Delivery permissions.
* Aug 21, 2013 1848 mpduff Check subscription.create and shared.subscription.create.
*
* </pre>
*
@ -339,19 +340,25 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
btn.setToolTipText("Select sites for sharing");
btn.setEnabled(false);
final String permission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE
final String createSharedSubPermission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE
.toString();
final String createSubPermission = DataDeliveryPermission.SUBSCRIPTION_CREATE
.toString();
final IUser user = UserController.getUserObject();
final String msg = user.uniqueId()
+ " is not authorized to create shared subscriptions. "
+ StringUtil.NEWLINE + "Permission: " + permission;
+ StringUtil.NEWLINE + "Permission: "
+ createSharedSubPermission;
try {
if (DataDeliveryServices.getPermissionsService()
.checkPermission(user, msg, permission).isAuthorized()) {
if (DataDeliveryServices
.getPermissionsService()
.checkPermissions(user, msg, createSharedSubPermission,
createSubPermission)
.hasPermission(createSharedSubPermission)) {
btn.setEnabled(true);
} else {
c.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
DataDeliveryGUIUtils.hideToolTip();

View file

@ -32,7 +32,8 @@ import com.raytheon.uf.common.auth.user.IUser;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 04, 2013 1441 djohnson Initial creation
* Jul 26, 2031 2232 mpduff Moved to common.auth.req.
* Jul 26, 2013 2232 mpduff Moved to common.auth.req.
* Aug 21, 2013 1848 mpduff Added to javadoc.
*
* </pre>
*
@ -63,7 +64,8 @@ public interface IPermissionsService {
}
/**
* Check whether a user has the specified permissions.
* Check whether a user has the specified permissions. If not authorized an
* AlertViz message is displayed to the user.
*
* @param user
* the user to check permissions for
@ -81,7 +83,9 @@ public interface IPermissionsService {
throws AuthException;
/**
* Check whether a user has one of the specified permissions.
* Check whether a user has one of the specified permissions. If no
* permissions are authorized then an AlertViz message is displayed to the
* user.
*
* @param user
* the user to check permissions for