components/visual-panels/usermgr/src/java/vpanels/app/usermgr/com/oracle/solaris/vp/panels/usermgr/client/swing/AuthRightsSettings.java
author devjani.ray@oracle.com <devjani.ray@oracle.com>
Wed, 30 Oct 2013 16:53:48 -0400
branchs11-update
changeset 2805 4888f6212f94
permissions -rw-r--r--
17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements 17548766 Backport 16808665 to 11.2 - User Manager Panel can assign profiles, but not auth
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2805
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     1
/*
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     2
 * CDDL HEADER START
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     3
 *
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     7
 *
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    11
 * and limitations under the License.
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    12
 *
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    18
 *
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    19
 * CDDL HEADER END
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    20
 */
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    21
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    22
/*
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    23
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    24
 */
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    25
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    26
package com.oracle.solaris.vp.panels.usermgr.client.swing;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    27
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    28
import javax.swing.*;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    29
import com.oracle.solaris.vp.util.misc.finder.Finder;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    30
import com.oracle.solaris.vp.util.misc.property.*;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    31
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    32
/**
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    33
 * Implements Advanced Settings for Authenticated Profiles
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    34
 */
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    35
public class AuthRightsSettings extends AdvancedSettings {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    36
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    37
    private static final String NAME =
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    38
    	Finder.getString("usermgr.advanced.auth_rights");
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    39
    private static final Icon ICON = Finder.getIcon(
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    40
	"images/rights-24.png");
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    41
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    42
    private UserMgrPanelDescriptor panelDesc = null;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    43
    private UserManagedObject userObj = null;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    44
    private AuthRightsPanel panel = null;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    45
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    46
    public AuthRightsSettings() {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    47
	super(NAME, ICON);
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    48
    }
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    49
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    50
    public void setUser(UserManagedObject userObj) {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    51
	if (panel == null) {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    52
		panel = new AuthRightsPanel(panelDesc, userObj);
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    53
	}
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    54
	panel.setUser(userObj);
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    55
	getProperty().update(userObj.getAuthRights(), false);
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    56
    }
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    57
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    58
    public void updateUser() {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    59
	userObj = panel.updateUser();
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    60
	getProperty().update(userObj.getAuthRights(), false);
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    61
    }
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    62
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    63
    public boolean isChanged() {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    64
        if (userObj != null) {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    65
	    return (userObj.getAuthRightsProperty().isChanged());
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    66
	} else {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    67
	    return false;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    68
	}
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    69
    }
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    70
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    71
    public void init(UserMgrPanelDescriptor panelDesc) {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    72
	this.panelDesc = panelDesc;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    73
    }
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    74
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    75
    public JPanel getPanel() {
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    76
    	return panel;
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    77
    }
4888f6212f94 17510631 Backport 16984138 to 11.2 - vp components must change to match RAD2 enhancements
devjani.ray@oracle.com <devjani.ray@oracle.com>
parents:
diff changeset
    78
}