public inbox for rhdb@sourceware.org
 help / color / mirror / Atom feed
From: Deepak B <ibetthisidisavailable@yahoo.ca>
To: rhdb@sources.redhat.com
Subject: Final set of changes to Administrator 2.0 (Java) for PostgreSQL 7.4 series.
Date: Wed, 09 Jun 2004 05:49:00 -0000	[thread overview]
Message-ID: <20040609054922.37013.qmail@web61108.mail.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

A bit late, but better than never :)

This patch brings Administrator up to speed with
7.4.x. All privileges items have been fixed to allow
the new WITH GRANT OPTION, while maintaining 7.3.x
compatibility. 

Also, thanks to Peter Eisentraut and Tom Lane for
quick replies to my queries regarding certain changes
in the ACL format for 7.4.x.

Attached is the diff file and an additional file,
PrivilegesCheckBoxPanel.java which is now required by
Administrator.

Deepak Bhole

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: PrivilegesCheckBoxPanel.java --]
[-- Type: text/x-java; name="PrivilegesCheckBoxPanel.java", Size: 16148 bytes --]

/*
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This software may be freely redistributed under the terms of the
 * GNU General Public License.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * Component of: Administrator GUI tool for PostgreSQL - Red Hat Edition
 */

package com.redhat.rhdb.admin;

/**
 * A Check Box panel specifically for privileges.
 * <p>
 * Based on com.redhat.rhdb.admin.CheckBoxPanel by <a href="mailto:bbooth@redhat.com">Brian Booth</a>
 *
 * @author  <a href="mailto:ibetthisidisavailable@yahoo.ca">Deepak Bhole</a>
 * 
 */

public class PrivilegesCheckBoxPanel extends javax.swing.JPanel implements java.awt.event.ActionListener {
	
	/** Creates a new instance of PrivilegesCheckBoxPanel */
    /**
     * Creates a CheckBoxPanel with a title
     * 
     * @param names An array of names associated with the CheckBoxes
     * @param layout the layout of the panel. Must be either CheckBoxPanel.HORIZONTAL or CheckBoxPanel.VERTICAL
     * @param title the title of the panel
     *
     */    
	public PrivilegesCheckBoxPanel(String[] names, String title, String secondaryCheckBoxTitle) {
		
		jchButtons = new javax.swing.JCheckBox[names.length];
		jchSecondaryButtons = new javax.swing.JCheckBox[names.length];
		hasChanged = new boolean[names.length];
		hasSecondaryChanged = new boolean[names.length];

		hasSecondaryCBEnabled = true;
		hasSecondaryCB = !secondaryCheckBoxTitle.equals("");
		java.awt.GridLayout gl;

		setLayout(new java.awt.GridBagLayout());
		java.awt.GridBagConstraints gridBagConstraints;

		for (int i = 0; i < names.length; i++) {
			gridBagConstraints = new java.awt.GridBagConstraints();
			gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 0);
			gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
			gridBagConstraints.gridx = 0;
			gridBagConstraints.gridy = i;
			gridBagConstraints.weightx = 1.0;
			gridBagConstraints.weighty = 1.0;
			jchButtons[i] = new javax.swing.JCheckBox(names[i]);
			jchButtons[i].setEnabled(false);
			add(jchButtons[i], gridBagConstraints);
			hasChanged[i] = false;
			jchButtons[i].addActionListener(this);
			
			if (hasSecondaryCB) {
				jchSecondaryButtons[i] = new javax.swing.JCheckBox(secondaryCheckBoxTitle);
				gridBagConstraints = new java.awt.GridBagConstraints();
				gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
				gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
				gridBagConstraints.gridx = 1;
				gridBagConstraints.gridy = i;
				gridBagConstraints.weightx = 1.0;
				gridBagConstraints.weighty = 1.0;
				hasSecondaryChanged[i] = false;
				jchSecondaryButtons[i].setEnabled(false);
				add(jchSecondaryButtons[i], gridBagConstraints);
				jchSecondaryButtons[i].addActionListener(this);
			}
		}

		setBorder(new javax.swing.border.TitledBorder(title));
	}
	
	/**.
     * For IDE Use.
     */
    public PrivilegesCheckBoxPanel() {
        super();
    }
	
    /**
     * Enables or disables the CheckBoxes
     * 
     * @param enabled true if the CheckBoxes are enabled, false otherwise.
     *
     */    
    public void setEnabled(boolean enabled) {

		for (int i = 0; i < jchButtons.length; i++) {
			jchButtons[i].setEnabled(enabled);
			
			if (hasSecondaryCB && jchButtons[i].isSelected())
				jchSecondaryButtons[i].setEnabled(hasSecondaryCBEnabled && enabled);
		}

		super.setEnabled(enabled);
    }
    
    /**
     * Deselects all checkboxes and clears history
     *
     */    
    public void reset() {

		for (int i = 0; i < jchButtons.length; i++) {
			jchButtons[i].setSelected(false);
			
			if (hasSecondaryCB) {
				jchSecondaryButtons[i].setSelected(false);
				jchSecondaryButtons[i].setEnabled(false);
			}

			hasChanged[i] = false;
			hasSecondaryChanged[i] = false;
		}

    }
    
    /**
     * Gets the text of the selected CheckBoxes
     * 
     * @return the text associated with the selected CheckBoxes
     *
	 */
	public String[] getSelectedBoxes() {
		
		int size = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (jchButtons[i].isSelected())
				size++;
		
		String[] names = new String[size];
		
		int index = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (jchButtons[i].isSelected()) {
				names[index] = jchButtons[i].getText();
				index++;
			}
		
		return names;
		
	}

    /**
     * Gets the text of the selected CheckBoxes
     * 
     * @return the text associated with the selected CheckBoxes
     *
	 */
	public String[] getPrimaryOnlySelectedBoxes() {
		
		int size = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (jchButtons[i].isSelected() && !(hasSecondaryCB && jchSecondaryButtons[i].isSelected()))
				size++;
		
		String[] names = new String[size];
		
		int index = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (jchButtons[i].isSelected() && !(hasSecondaryCB && jchSecondaryButtons[i].isSelected())) {
				names[index] = jchButtons[i].getText();
				index++;
			}
		
		return names;
		
	}
	
	/**
     * Gets the text of the selected secondary CheckBoxes
     * 
     * @return the text associated with the selected secondary CheckBoxes
     *
	 */
	public String[] getSelectedSecondaryBoxes() {
		
		int size = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (hasSecondaryCB && jchButtons[i].isSelected() && jchSecondaryButtons[i].isSelected())
				size++;
		
		String[] names = new String[size];
		
		int index = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (hasSecondaryCB && jchButtons[i].isSelected() && jchSecondaryButtons[i].isSelected()) {
				names[index] = jchButtons[i].getText();
				index++;
			}

		return names;
	}
	
	/**
     * Gets the indexes of the selected CheckBoxes
     * 
     * @return the indexes associated with the selected CheckBoxes
     *
     */    
	public int[] getSelectedIndexes() {
		
		int size = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (jchButtons[i].isSelected())
				size++;
		
		int[] indexes = new int[size];
		
		int index = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (jchButtons[i].isSelected()) {
				indexes[index] = i;
				index++;
			}
		
		return indexes;
	}

    /**
     * Gets the indexes of the selected and enabled secondary CheckBoxes
     * 
     * @return the indexes associated with the selected and enabled secondary CheckBoxes
     */    

	public int[] getSelectedSecondaryIndexes() {

		int size = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (hasSecondaryCB && jchButtons[i].isSelected() && jchSecondaryButtons[i].isSelected())
				size++;
		
		int[] indexes = new int[size];
		
		int index = 0;
		
		for (int i = 0; i < jchButtons.length; i++)
			if (hasSecondaryCB && jchButtons[i].isSelected() && jchSecondaryButtons[i].isSelected()) {
				indexes[index] = i;
				index++;
			}

		return indexes;
	}
	
	/**
     * Checks if the chechbox is selected at the given index 
     *
     * @return  Returns true if the checkbox at 'index' is selected and
     * 		false otherwise    
     *
     */    
    public boolean isSelected(int index) {
		return jchButtons[index].isSelected();
   }
   
   /**
     * Checks if the secondary chechbox is selected at the given index 
     *
     * @return  Returns true if the checkbox at 'index' is selected and
     * 		false otherwise    
     *
     */    
    public boolean isSecondarySelected(int index) {
		if (hasSecondaryCB)
			return jchSecondaryButtons[index].isSelected();
		else
			return false;
   }

	/**
     * Sets the Selection mode of the CheckBox at the given index
     * 
     * @param index the index of the RadioButton you want to select
     * @param isSelect true if the CheckBox is selected, false otherwise
     *
     */    
    public void setSelectedBox(int index, boolean isSelect) {
		jchButtons[index].setSelected(isSelect);
		
		if (isSelect)
			jchSecondaryButtons[index].setEnabled(true);
    }

	/**
     * Sets the Selection mode of the secondary CheckBox at the given index
     * 
     * @param index the index of the RadioButton you want to select
     * @param isSelect true if the CheckBox is selected, false otherwise
     *
     */    
    public void setSelectedSecondaryBox(int index, boolean isSelect) {
		if (hasSecondaryCB)
			jchButtons[index].setSelected(isSelect);
    }
	
	/**
     * Sets the Selection mode of the CheckBoxes at the given indexes
     * 
     * @param indexes the indexes of the CheckBoxes you want to select
     * @param isSelect true if the CheckBoxes are selected, false otherwise
     *
     */    
    public void setSelectedBoxes(int[] indexes, boolean isSelect) {
    	for (int i = 0; i < indexes.length; i++) {
			jchButtons[indexes[i]].setSelected(isSelect);
			
			if (hasSecondaryCB && isSelect)
				jchSecondaryButtons[indexes[i]].setEnabled(hasSecondaryCBEnabled && true);
		}
    }

 	/**
     * Sets the Selection mode of the Secondary CheckBoxes at the given indexes.
	 * Secondary CB's can be selected iff the primary is selected.
	 *
     * 
     * @param indexes the indexes of the CheckBoxes you want to select
     * @param isSelect true if the CheckBoxes are selected, false otherwise
     *
     */    
    public void setSelectedSecondaryBoxes(int[] indexes, boolean isSelect) {
		if (!hasSecondaryCB)
			return;
		
    	for (int i = 0; i < indexes.length; i++) {
			if (jchButtons[indexes[i]].isSelected())
				jchSecondaryButtons[indexes[i]].setSelected(isSelect);
		}
    }
	
	/**
     * Sets the Selection mode of the first CheckBox with the given text
     * 
     * @param str the text associated with the CheckBox you want to select
     * @param isSelect true if the CheckBox is selected, false otherwise
     *
     */    
    public void setSelectedBox(String str, boolean isSelect) {
		for (int i = 0; i < jchButtons.length; i++)
			if (str.equals(jchButtons[i].getText())) {
				jchButtons[i].setSelected(isSelect);
				
				if (hasSecondaryCB && isSelect)
					jchSecondaryButtons[i].setEnabled(hasSecondaryCBEnabled && true);
				
			}
    }
    
	/**
     * Sets the Selection mode of the first secondary CheckBox with the given text (for the primary)
     * 
     * @param str the text associated with the CheckBox whose secondary you want to select
     * @param isSelect true if the CheckBox is selected, false otherwise
     *
     */

	public void setSelectedSecondaryBox(String str, boolean isSelect) {
		for (int i = 0; i < jchButtons.length; i++)
			if (hasSecondaryCB && str.equals(jchButtons[i].getText()) && jchButtons[i].isSelected())
				jchSecondaryButtons[i].setSelected(isSelect);
    }
	
	/**
     * Sets the Selection mode of the CheckBoxes that have the given text
     * 
     * @param str the text associated with the CheckBoxes you want to select
     * @param isSelect true if the CheckBoxes are selected, false otherwise
     *
     */
    public void setSelectedBoxes(String[] str, boolean isSelect) {
		for (int i = 0; i < jchButtons.length; i++)
			for (int j = 0; j < str.length; j++)
				if (str[j].equals(jchButtons[i].getText())) {
					jchSecondaryButtons[i].setSelected(isSelect);
					
					if (hasSecondaryCB && isSelect)
						jchSecondaryButtons[i].setEnabled(hasSecondaryCBEnabled && true);
				}
    }
	
	/**
     * Sets the Selection mode of the secondary CheckBoxes whose primary have the given text
     * 
     * @param str the text associated with the CheckBoxes whose secondary you want to select
     * @param isSelect true if the CheckBoxes are selected, false otherwise
     *
     */
    public void setSelectedSecondaryBoxes(String[] str, boolean isSelect) {
		for (int i = 0; i < jchButtons.length; i++)
			for (int j = 0; j < str.length; j++)
				if (hasSecondaryCB && str[j].equals(jchButtons[i].getText()) && jchButtons[i].isSelected())
					jchSecondaryButtons[i].setSelected(isSelect);
    }

    /**
     * Gets the indexes of the CheckBoxes whose values have changed (Primary or Secondary).
     * 
     * @return the indexes associated with the CheckBoxes whose values have changed.
     *
     */    
	public int[] getChangedIndexes() {
		int size = 0;
		
		for (int i = 0; i < hasChanged.length; i++) {
			if (hasChanged[i] || (hasSecondaryCB && hasSecondaryChanged[i]))
				size++;
		}
		
		int[] toReturn = new int[size];
		int index = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i] || (hasSecondaryCB && hasSecondaryChanged[i])) {
				toReturn[index] = i;
				index++;
			}
		
		return toReturn;
	}

    /**
     * Gets the indexes of the primary CheckBoxes whose values have changed.
     * 
     * @return the indexes associated with the CheckBoxes whose values have changed.
     *
     */    
	public int[] getChangedPrimaryIndexes() {
		int size = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i])
				size++;
		
		int[] toReturn = new int[size];
		int index = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i]) {
				toReturn[index] = i;
				index++;
			}
		
		return toReturn;
	}
	
     /**
     * Gets the indexes of the secondary CheckBoxes whose values have changed.
     * 
     * @return the indexes associated with the CheckBoxes whose values have changed.
     *
     */    
	public int[] getChangedSecondaryIndexes() {
		
		if (!hasSecondaryCB) {
			return new int[0];
		}
		
		int size = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i])
				size++;
		
		int[] toReturn = new int[size];
		int index = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i]) {
				toReturn[index] = i;
				index++;
			}
		
		return toReturn;
	}
	
	/**
     * Gets the text of the CheckBoxes whose values have changed.
     * 
     * @return the text associated with the CheckBoxes whose values have changed.
     *
     */    
	public String[] getChangedStrings() {
		int size = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i] || (hasSecondaryCB && hasSecondaryChanged[i]))
				size++;
		
		String[] toReturn = new String[size];
		int index = 0;
		
		for (int i = 0; i < hasChanged.length; i++)
			if (hasChanged[i] || (hasSecondaryCB && hasSecondaryChanged[i])) {
				toReturn[index] = jchButtons[i].getText();
				index++;
			}
		
		return toReturn;
	}

    /**
	 * Set all secondary checkboxes to given state (selected items are unselected).
	 *
	 * @param enabled The state to set the boxes to.
	 */
	
	public void setSecondaryCBEnabled(boolean enabled) {
		if (!hasSecondaryCB)
			return;
		
		hasSecondaryCBEnabled = enabled;
		for (int i=0; i < jchSecondaryButtons.length; i++) {
			jchSecondaryButtons[i].setSelected(false);
			jchSecondaryButtons[i].setEnabled(enabled);
		}
	}
	
	 /**
     * Run whenever a CheckBoxes value changes. Fires a PropertyChangedEvent
     * 
     * @param evt the selection or de-selection of a CheckBox
     *
     */    
    public void actionPerformed(java.awt.event.ActionEvent evt) {
        for (int i = 0; i < jchButtons.length; i++) {
			if (evt.getSource() == jchButtons[i])
				hasChanged[i] = !hasChanged[i];
			
			if (hasSecondaryCB && evt.getSource() == jchSecondaryButtons[i]) {
				hasSecondaryChanged[i] = !hasSecondaryChanged[i];
			}

			if (evt.getSource() == jchButtons[i]) {
				if (jchButtons[i].isSelected()) {
					if (hasSecondaryCB) 
						jchSecondaryButtons[i].setEnabled(hasSecondaryCBEnabled && true);
				} else {
					if (hasSecondaryCB)
						jchSecondaryButtons[i].setEnabled(false);
				}
			}
		}

		firePropertyChange(SELECTION_MADE, !hasChanged[0], hasChanged[0]);
    }

	protected javax.swing.JCheckBox[] jchButtons = new javax.swing.JCheckBox[0];
	protected javax.swing.JCheckBox[] jchSecondaryButtons = new javax.swing.JCheckBox[0];
    protected boolean[] hasChanged = new boolean[0];
	protected boolean[] hasSecondaryChanged = new boolean[0];

	private boolean hasSecondaryCB = false;
	private boolean hasSecondaryCBEnabled = true;
	
	/** Name of the PropertyChangeEvent */
    public static final String SELECTION_MADE = "Check Box Selected";
}

[-- Attachment #3: administrator-7.4patch-3 --]
[-- Type: application/octet-stream, Size: 161439 bytes --]

? src/com/redhat/rhdb/admin/PrivilegesCheckBoxPanel.java
Index: ChangeLog
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/ChangeLog,v
retrieving revision 1.8
diff -c -r1.8 ChangeLog
*** ChangeLog	4 May 2004 16:57:14 -0000	1.8
--- ChangeLog	9 Jun 2004 05:39:20 -0000
***************
*** 1,3 ****
--- 1,108 ----
+ 2004-06-09  Deepak Bhole  <ibetthisidisavailable@yahoo.ca>
+ 
+ 	* src/com/redhat/rhdb/admin/CheckBoxPanel.java: Added intialization
+ 	code for checkbox/boolean arrays to prevent NullPointerException's.  
+ 	* src/com/redhat/rhdb/admin/EditPrivilegesDialog.form: Changed by the
+ 	IDE.
+ 	* src/com/redhat/rhdb/admin/EditPrivilegesDialog.java: Added
+ 	code to get the GRANT OPTION string (OPTION GRANT WITH), so that the
+ 	appropriate checkboxes show up in 7.4.x versions. Changed jpPrivileges
+ 	to be of type PrivilegesCheckBoxPanel which is more suited, given the
+ 	changes to the Privileges structure in 7.4.x.
+ 	(jcbPublicActionPerformed): New scaffolding function. Updates status
+ 	of the OPTION GRANT WITH checkbox to ensure that only "users" can be
+ 	given that privilege option.
+ 	(jlGroupsValueChanged): Ditto.
+ 	(jlUsersValueChanged): Ditto.
+ 	(adjustGrantWithBoxes): New function .Updates status of the OPTION
+ 	GRANT WITH checkbox to ensure that only "users" can begiven that
+ 	privilege option.
+ 	(doApplyAction): Change function to work with the new WITH GRANT
+ 	OPTION option for 7.4.x backends.
+ 	(getPrivileges): Ditto.
+ 	(updatePrivileges): Ditto. Based on the privilege, the WITH GRANT
+ 	OPTION checkbox is checked as needed.  
+ 	* src/com/redhat/rhdb/admin/ManagePrivilegesDialog.form: Changed by the
+ 	IDE.  
+ 	* src/com/redhat/rhdb/admin/ManagePrivilegesDialog.java: Changed
+ 	constructor to initialize the grantOptionString so that the WITH GRANT
+ 	OPTION checkboxes show up. Changed jpDatabasePriv, jpSchemaPriv,
+ 	jpTablePriv, jpViewPriv, jpSequencesPriv, jpLanguagesPriv and
+ 	jpFunctionPriv to be PrivilegesCheckBoxPanel which is more suited for
+ 	the new privileges functionality in 7.4.x.
+ 	(languagePrivilegeChange): Fix bug in function that caused apply to be
+ 	disabled if multiple items were selected (it should be enabled since a
+ 	mass change is about to happen, and the user should be aware of what
+ 	is about to happen whether even if in the end, nothing may really
+ 	change).
+ 	(functionPrivilegeChange): Ditto.
+ 	(sequencePrivilegeChange): Ditto.
+ 	(viewPrivilegeChange): Ditto.
+ 	(tablePrivilegeChange): Ditto.
+ 	(schemaPrivilegeChange): Ditto.
+ 	(databasePrivilegeChange): Ditto.
+ 	(schemaSelected): Change function to work with the new WITH GRANT
+ 	OPTION option for 7.4.x backends. Based on the privilege, the WITH
+ 	GRANT OPTION checkbox is checked as needed.
+ 	(databaseSelected): Ditto.
+ 	(functionSelected): Ditto.
+ 	(languageSelected): Ditto.
+ 	(sequenceSelected): Ditto.
+ 	(viewSelected): Ditto.
+ 	(tableSelected): Ditto.
+ 	(updatePrivileges): Change function to work with the new WITH GRANT
+ 	OPTION in 7.4.x backends.
+ 	* src/com/redhat/rhdb/admin/ObjectUpdate.java: Added new tokens
+ 	pertaining to the WITH GRANT OPTION option.
+ 	* src/com/redhat/rhdb/admin/PrivilegesCheckBoxPanel.java: New file. A
+ 	more complex extension of CheckBoxPanel (not inherited due to too many
+ 	differences). This panel allows "secondary" checkboxes which behave in
+ 	a manner required by the privilege dialogs for the WITH GRANT OPTION
+ 	option.
+ 	* src/com/redhat/rhdb/admin/PrivilegesUpdate.java
+ 	(getUpdateFunctionPrivString): Change function to work with the new
+ 	WITH GRANT OPTION option.
+ 	(getUpdateLanguagePrivString): Ditto.
+ 	(getUpdateViewPrivString): Ditto.
+ 	(getUpdateSequencePrivString): Ditto.
+ 	(getUpdateDatabasePrivString): Ditto.
+ 	(getUpdateSchemaPrivString): Ditto.
+ 	(getUpdateTablePrivString): Ditto.
+ 	* src/com/redhat/rhdb/admin/pgsql/AbstractRhdb73DatabaseMetaData.java
+ 	(getDatabasePrivileges): Change function to return 2 more fields,
+ 	GRANTOR and IS_GRANTABLE (as defined in JDBC specs for
+ 	getTablePrivileges()).
+ 	(getFunctionPrivileges): Ditto.
+ 	(getGrantOptionString): New function. Returns the grant option
+ 	string. Emmpty string for 7.3.x and lower backends.
+ 	(getLanguagePrivileges): Change function to return 2 more fields,
+ 	GRANTOR and IS_GRANTABLE (as defined in JDBC specs for
+ 	getTablePrivileges()).
+ 	(getSchemaPrivileges): Ditto.
+ 	(getSequencePrivileges): Ditto.
+ 	(getTablePrivileges): Ditto.
+ 	(getViewPrivileges): Ditto.
+ 	(getACLComponents): New function. Takes in ACL in format as per 7.4.x
+ 	docs, and breaks it down into components.
+ 	(parseACLArray): Overloaded helper function from PostgreSQL JDBC.
+ 	(addACLPrivileges): Ditto.
+ 	(parseACL): Ditto.
+ 	* src/com/redhat/rhdb/admin/pgsql/AbstractRhdb74DatabaseMetaData.java:
+ 	(getGrantOptionString): New function. Returns the grant option
+ 	string for 7.4.x and higher backends.
+ 	* src/com/redhat/rhdb/admin/pgsql/AdminDatabaseMetaData.java
+ 	(getGrantOptionString): New function added to interface.
+ 	* src/com/redhat/rhdb/admin/tree/DatabaseNode.java (raiseView): Change
+ 	function to show IS_GRANTABLE and GRANTOR in the privileges row for
+ 	the view.
+ 	* src/com/redhat/rhdb/admin/tree/FunctionNode.java: Ditto.
+ 	* src/com/redhat/rhdb/admin/tree/LanguageNode.java: Ditto.
+ 	* src/com/redhat/rhdb/admin/tree/SchemaNode.java: Ditto.
+ 	* src/com/redhat/rhdb/admin/tree/SequenceNode.java: Ditto.
+ 	* src/com/redhat/rhdb/admin/tree/TableNode.java: Ditto.
+ 	* src/com/redhat/rhdb/admin/tree/ViewNode.java: Ditto.
+ 	
+ 
  2004-05-04  Deepak Bhole  <ibetthisidisavailable@yahoo.ca>
  
  	* src/com/redhat/rhdb/admin/AddColumnDialog.java: Added support for
Index: src/com/redhat/rhdb/admin/Administrator.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/Administrator.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Administrator.java
*** src/com/redhat/rhdb/admin/Administrator.java	21 Nov 2003 18:30:20 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/Administrator.java	9 Jun 2004 05:39:20 -0000
***************
*** 33,37 ****
  		MetalLookAndFeel.setCurrentTheme(new AdminLookAndFeel());
  		new MainWindow().show();
  	}
! 	
  }
--- 33,37 ----
  		MetalLookAndFeel.setCurrentTheme(new AdminLookAndFeel());
  		new MainWindow().show();
  	}
! 
  }
Index: src/com/redhat/rhdb/admin/CheckBoxPanel.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/CheckBoxPanel.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 CheckBoxPanel.java
*** src/com/redhat/rhdb/admin/CheckBoxPanel.java	21 Nov 2003 18:30:21 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/CheckBoxPanel.java	9 Jun 2004 05:39:20 -0000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   *
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   *
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
***************
*** 313,320 ****
  	firePropertyChange(SELECTION_MADE, !hasChanged[0], hasChanged[0]);
      }
  
!     private javax.swing.JCheckBox[] jchButtons;
!     private boolean[] hasChanged;
  
      /** Static Layout Value - Displays Buttons Horizontally */
      public static final int HORIZONTAL = 1;
--- 313,320 ----
  	firePropertyChange(SELECTION_MADE, !hasChanged[0], hasChanged[0]);
      }
  
!     protected javax.swing.JCheckBox[] jchButtons = new javax.swing.JCheckBox[0];
!     protected boolean[] hasChanged = new boolean[0];
  
      /** Static Layout Value - Displays Buttons Horizontally */
      public static final int HORIZONTAL = 1;
Index: src/com/redhat/rhdb/admin/EditPrivilegesDialog.form
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/EditPrivilegesDialog.form,v
retrieving revision 1.1
diff -c -r1.1 EditPrivilegesDialog.form
*** src/com/redhat/rhdb/admin/EditPrivilegesDialog.form	14 Jan 2004 00:53:50 -0000	1.1
--- src/com/redhat/rhdb/admin/EditPrivilegesDialog.form	9 Jun 2004 05:39:20 -0000
***************
*** 37,42 ****
--- 37,45 ----
                <Connection code="AdminResources.getString(AdminResources.DLG_EDIT_PRIVILEGES_PUBLIC)" type="code"/>
              </Property>
            </Properties>
+           <Events>
+             <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jcbPublicActionPerformed"/>
+           </Events>
            <AuxValues>
              <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jcbPublic.addActionListener(new java.awt.event.ActionListener() {&#xa;            public void actionPerformed(java.awt.event.ActionEvent evt) {&#xa;                updatePrivileges();&#xa;            }&#xa;        });"/>
            </AuxValues>
***************
*** 80,85 ****
--- 83,91 ----
            <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
            <SubComponents>
              <Component class="com.redhat.rhdb.admin.AdminList" name="jlUsers">
+               <Events>
+                 <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jlUsersValueChanged"/>
+               </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jlUsers.addListSelectionListener(new javax.swing.event.ListSelectionListener() {&#xa;            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {&#xa;                updatePrivileges();&#xa;            }&#xa;        });"/>
                </AuxValues>
***************
*** 96,118 ****
            <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
            <SubComponents>
              <Component class="com.redhat.rhdb.admin.AdminList" name="jlGroups">
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jlGroups.addListSelectionListener(new javax.swing.event.ListSelectionListener() {&#xa;            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {&#xa;                updatePrivileges();&#xa;            }&#xa;        });"/>
                </AuxValues>
              </Component>
            </SubComponents>
          </Container>
!         <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpPrivileges">
            <Events>
              <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="checkPrivilegeChange"/>
            </Events>
            <AuxValues>
!             <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpPrivileges.setEnabled(false);"/>
!             <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel (privileges, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_EDIT_PRIVILEGES_PRIVILEGES));"/>
            </AuxValues>
            <Constraints>
              <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
!               <GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="0" fill="1" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="0" insetsRight="3" anchor="10" weightX="0.5" weightY="0.0"/>
              </Constraint>
            </Constraints>
  
--- 102,126 ----
            <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
            <SubComponents>
              <Component class="com.redhat.rhdb.admin.AdminList" name="jlGroups">
+               <Events>
+                 <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jlGroupsValueChanged"/>
+               </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jlGroups.addListSelectionListener(new javax.swing.event.ListSelectionListener() {&#xa;            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {&#xa;                updatePrivileges();&#xa;            }&#xa;        });"/>
                </AuxValues>
              </Component>
            </SubComponents>
          </Container>
!         <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpPrivileges">
            <Events>
              <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="checkPrivilegeChange"/>
            </Events>
            <AuxValues>
!             <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value=" new PrivilegesCheckBoxPanel (privileges, AdminResources.getString(AdminResources.DLG_EDIT_PRIVILEGES_PRIVILEGES), grantOptionString);"/>
            </AuxValues>
            <Constraints>
              <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
!               <GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="0" fill="1" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="0" insetsRight="3" anchor="10" weightX="0.5" weightY="0.0"/>
              </Constraint>
            </Constraints>
  
Index: src/com/redhat/rhdb/admin/EditPrivilegesDialog.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/EditPrivilegesDialog.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 EditPrivilegesDialog.java
*** src/com/redhat/rhdb/admin/EditPrivilegesDialog.java	21 Nov 2003 18:30:22 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/EditPrivilegesDialog.java	9 Jun 2004 05:39:21 -0000
***************
*** 1,5 ****
  /**
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /**
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 74,80 ****
              privileges = dbmd.getValidSchemaPrivileges();
          else if (invocationNode instanceof DatabaseNode)
              privileges = dbmd.getValidDatabasePrivileges();
!         
          initComponents();
          
          // update title
--- 74,82 ----
              privileges = dbmd.getValidSchemaPrivileges();
          else if (invocationNode instanceof DatabaseNode)
              privileges = dbmd.getValidDatabasePrivileges();
! 
! 		grantOptionString = dbmd.getGrantOptionString();
! 		
          initComponents();
          
          // update title
***************
*** 124,130 ****
          jlUsers = new com.redhat.rhdb.admin.AdminList();
          jspGroups = new javax.swing.JScrollPane();
          jlGroups = new com.redhat.rhdb.admin.AdminList();
!         jpPrivileges = new CheckBoxPanel (privileges, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_EDIT_PRIVILEGES_PRIVILEGES));
          jpButtons = new javax.swing.JPanel();
          jbOK = okAction.getButton();
          jbApply = applyAction.getButton();
--- 126,132 ----
          jlUsers = new com.redhat.rhdb.admin.AdminList();
          jspGroups = new javax.swing.JScrollPane();
          jlGroups = new com.redhat.rhdb.admin.AdminList();
!         jpPrivileges =  new PrivilegesCheckBoxPanel (privileges, AdminResources.getString(AdminResources.DLG_EDIT_PRIVILEGES_PRIVILEGES), grantOptionString);
          jpButtons = new javax.swing.JPanel();
          jbOK = okAction.getButton();
          jbApply = applyAction.getButton();
***************
*** 145,150 ****
--- 147,158 ----
                  updatePrivileges();
              }
          });
+         jcbPublic.addActionListener(new java.awt.event.ActionListener() {
+             public void actionPerformed(java.awt.event.ActionEvent evt) {
+                 jcbPublicActionPerformed(evt);
+             }
+         });
+ 
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 0;
          gridBagConstraints.gridy = 0;
***************
*** 174,179 ****
--- 182,193 ----
                  updatePrivileges();
              }
          });
+         jlUsers.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+             public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
+                 jlUsersValueChanged(evt);
+             }
+         });
+ 
          jspUsers.setViewportView(jlUsers);
  
          gridBagConstraints = new java.awt.GridBagConstraints();
***************
*** 190,195 ****
--- 204,215 ----
                  updatePrivileges();
              }
          });
+         jlGroups.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+             public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
+                 jlGroupsValueChanged(evt);
+             }
+         });
+ 
          jspGroups.setViewportView(jlGroups);
  
          gridBagConstraints = new java.awt.GridBagConstraints();
***************
*** 201,207 ****
          gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3);
          jpOptions.add(jspGroups, gridBagConstraints);
  
-         jpPrivileges.setEnabled(false);
          jpPrivileges.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
              public void propertyChange(java.beans.PropertyChangeEvent evt) {
                  checkPrivilegeChange(evt);
--- 221,226 ----
***************
*** 210,216 ****
  
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 2;
!         gridBagConstraints.gridy = 0;
          gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
          gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
          gridBagConstraints.weightx = 0.5;
--- 229,235 ----
  
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 2;
!         gridBagConstraints.gridy = 2;
          gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
          gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
          gridBagConstraints.weightx = 0.5;
***************
*** 233,243 ****
          setSize(new java.awt.Dimension(500, 300));
      }//GEN-END:initComponents
  
!     private void checkPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_checkPrivilegeChange
!         // Add your handling code here:
  		
          // get number of selected items in the lists
          int numSelected = jlUsers.getSelectedValues().length + jlGroups.getSelectedValues().length;
  		
          // Disable apply button, if none of the priveleges are changed during single selection
          // In all other cases enable it.
--- 252,287 ----
          setSize(new java.awt.Dimension(500, 300));
      }//GEN-END:initComponents
  
! 	private void jcbPublicActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPublicActionPerformed
! 		adjustGrantWithBoxes();
! 	}//GEN-LAST:event_jcbPublicActionPerformed
! 
! 	private void jlGroupsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jlGroupsValueChanged
! 		adjustGrantWithBoxes();
! 	}//GEN-LAST:event_jlGroupsValueChanged
! 
! 	private void jlUsersValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jlUsersValueChanged
! 		adjustGrantWithBoxes();
! 	}//GEN-LAST:event_jlUsersValueChanged
! 	
! 	/**
! 	 * Enabled the GRANT WITH OPTION only if applicable
! 	 */
! 	
! 	private void adjustGrantWithBoxes() {
! 		if (jlGroups.getSelectedValues().length > 0 || jcbPublic.isSelected()) {
! 			jpPrivileges.setSecondaryCBEnabled(false);
! 		} else {
! 			jpPrivileges.setSecondaryCBEnabled(true);
! 		}
! 	}
! 	
! 	private void checkPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_checkPrivilegeChange
! 		 // Add your handling code here:
  		
          // get number of selected items in the lists
          int numSelected = jlUsers.getSelectedValues().length + jlGroups.getSelectedValues().length;
+ 		numSelected += this.jcbPublic.isSelected() ? numSelected+1 : numSelected;
  		
          // Disable apply button, if none of the priveleges are changed during single selection
          // In all other cases enable it.
***************
*** 246,252 ****
              jbApply.setEnabled(false);
          else 
              jbApply.setEnabled(true);
!     }//GEN-LAST:event_checkPrivilegeChange
      
      /** Closes the dialog */
      private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
--- 290,297 ----
              jbApply.setEnabled(false);
          else 
              jbApply.setEnabled(true);
! 
! 	}//GEN-LAST:event_checkPrivilegeChange
      
      /** Closes the dialog */
      private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
***************
*** 293,300 ****
          Hashtable parameters = new Hashtable();
          Object[] users = jlUsers.getSelectedValues();
          Object[] groups = jlGroups.getSelectedValues();
!         String[] privileges = jpPrivileges.getSelectedBoxes();
!         
          // Add the entries into the hash table
          
          if (jcbPublic.isSelected())
--- 338,346 ----
          Hashtable parameters = new Hashtable();
          Object[] users = jlUsers.getSelectedValues();
          Object[] groups = jlGroups.getSelectedValues();
!         String[] privileges = jpPrivileges.getPrimaryOnlySelectedBoxes();
! 		String[] privilegesWithGrant = jpPrivileges.getSelectedSecondaryBoxes();
! 		
          // Add the entries into the hash table
          
          if (jcbPublic.isSelected())
***************
*** 322,328 ****
          for (int i = 0; i < privileges.length; i++)
              privilegeSet.put(privileges[i], privileges[i]);
          
!         // Add calling object
          Hashtable objectSet = new Hashtable();
          objectSet.put(invocationNode.toString(), invocationNode.toString());
          
--- 368,380 ----
          for (int i = 0; i < privileges.length; i++)
              privilegeSet.put(privileges[i], privileges[i]);
          
!         // Add privileges
!         Hashtable privilegeWithGrantSet = new Hashtable();
!         
!         for (int i = 0; i < privilegesWithGrant.length; i++)
!             privilegeWithGrantSet.put(privilegesWithGrant[i], privilegesWithGrant[i]);
! 		
! 		// Add calling object
          Hashtable objectSet = new Hashtable();
          objectSet.put(invocationNode.toString(), invocationNode.toString());
          
***************
*** 337,342 ****
--- 389,395 ----
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((FunctionNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_FUNCTIONS, objectSet);
                      parameters.put(ObjectUpdate.PARAM_FUNCTION_PRIVILEGES, privilegeSet);
+ 					parameters.put(ObjectUpdate.PARAM_FUNCTION_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
                      PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  		    
                  } else if (invocationNode instanceof LanguageNode) {
***************
*** 345,351 ****
                      parameters.put(ObjectUpdate.PARAM_DB_NAME, ((LanguageNode) invocationNode).getParentDatabaseName());
                      parameters.put(ObjectUpdate.PARAM_LANGUAGES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_LANGUAGE_PRIVILEGES, privilegeSet);
!                     PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  		    
                  } else if (invocationNode instanceof SequenceNode) {
                      // Sequences
--- 398,405 ----
                      parameters.put(ObjectUpdate.PARAM_DB_NAME, ((LanguageNode) invocationNode).getParentDatabaseName());
                      parameters.put(ObjectUpdate.PARAM_LANGUAGES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_LANGUAGE_PRIVILEGES, privilegeSet);
!                     parameters.put(ObjectUpdate.PARAM_LANGUAGE_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
! 					PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  		    
                  } else if (invocationNode instanceof SequenceNode) {
                      // Sequences
***************
*** 354,360 ****
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((SequenceNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_SEQUENCES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_SEQUENCE_PRIVILEGES, privilegeSet);
!                     PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  
                  } else if (invocationNode instanceof TableNode) {
                      // Tables
--- 408,415 ----
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((SequenceNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_SEQUENCES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_SEQUENCE_PRIVILEGES, privilegeSet);
!                     parameters.put(ObjectUpdate.PARAM_SEQUENCE_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
! 					PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  
                  } else if (invocationNode instanceof TableNode) {
                      // Tables
***************
*** 363,369 ****
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((TableNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_TABLES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_TABLE_PRIVILEGES, privilegeSet);
!                     PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  
                  } else if (invocationNode instanceof ViewNode) {
                      // Views
--- 418,425 ----
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((TableNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_TABLES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_TABLE_PRIVILEGES, privilegeSet);
!                     parameters.put(ObjectUpdate.PARAM_TABLE_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
! 					PrivilegesUpdate.updatePrivileges(backendClient, parameters);
  
                  } else if (invocationNode instanceof ViewNode) {
                      // Views
***************
*** 372,400 ****
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((ViewNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_VIEWS, objectSet);
                      parameters.put(ObjectUpdate.PARAM_VIEW_PRIVILEGES, privilegeSet);
!                     PrivilegesUpdate.updatePrivileges(backendClient, parameters);
                  } else if (invocationNode instanceof SchemaNode) {
                      // Schemas
                      parameters.put(ObjectUpdate.PARAM_CLUSTER_NAME, ((SchemaNode) invocationNode).getParentClusterName());
                      parameters.put(ObjectUpdate.PARAM_DB_NAME, ((SchemaNode) invocationNode).getParentDatabaseName());
                      parameters.put(ObjectUpdate.PARAM_SCHEMAS, objectSet);
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_PRIVILEGES, privilegeSet);
!                     PrivilegesUpdate.updatePrivileges(backendClient, parameters);
                  } else if (invocationNode instanceof DatabaseNode) {
                      // Databases
                      parameters.put(ObjectUpdate.PARAM_CLUSTER_NAME, ((DatabaseNode) invocationNode).getParentClusterName());
                      parameters.put(ObjectUpdate.PARAM_DB_NAME, invocationNode.toString());
                      parameters.put(ObjectUpdate.PARAM_DATABASES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_DATABASE_PRIVILEGES, privilegeSet);
!                     PrivilegesUpdate.updatePrivileges(backendClient, parameters);
                  }
  
                  invocationNode.reloadView(backendClient);
                  
                  // Reset the privileges panel.
                  int[] justApplied = jpPrivileges.getSelectedIndexes();
                  jpPrivileges.reset();
                  jpPrivileges.setSelectedBoxes(justApplied, true);
                  
          } catch (ObjectUpdateException e) {
  		e.printStackTrace();
--- 428,461 ----
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_NAME, ((ViewNode) invocationNode).getParentSchemaName());
                      parameters.put(ObjectUpdate.PARAM_VIEWS, objectSet);
                      parameters.put(ObjectUpdate.PARAM_VIEW_PRIVILEGES, privilegeSet);
!                     parameters.put(ObjectUpdate.PARAM_VIEW_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
! 					PrivilegesUpdate.updatePrivileges(backendClient, parameters);
                  } else if (invocationNode instanceof SchemaNode) {
                      // Schemas
                      parameters.put(ObjectUpdate.PARAM_CLUSTER_NAME, ((SchemaNode) invocationNode).getParentClusterName());
                      parameters.put(ObjectUpdate.PARAM_DB_NAME, ((SchemaNode) invocationNode).getParentDatabaseName());
                      parameters.put(ObjectUpdate.PARAM_SCHEMAS, objectSet);
                      parameters.put(ObjectUpdate.PARAM_SCHEMA_PRIVILEGES, privilegeSet);
!                     parameters.put(ObjectUpdate.PARAM_SCHEMA_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
! 					PrivilegesUpdate.updatePrivileges(backendClient, parameters);
                  } else if (invocationNode instanceof DatabaseNode) {
                      // Databases
                      parameters.put(ObjectUpdate.PARAM_CLUSTER_NAME, ((DatabaseNode) invocationNode).getParentClusterName());
                      parameters.put(ObjectUpdate.PARAM_DB_NAME, invocationNode.toString());
                      parameters.put(ObjectUpdate.PARAM_DATABASES, objectSet);
                      parameters.put(ObjectUpdate.PARAM_DATABASE_PRIVILEGES, privilegeSet);
!                     parameters.put(ObjectUpdate.PARAM_DATABASE_PRIVILEGES_WITH_GRANT, privilegeWithGrantSet);
! 					PrivilegesUpdate.updatePrivileges(backendClient, parameters);
                  }
  
                  invocationNode.reloadView(backendClient);
                  
                  // Reset the privileges panel.
                  int[] justApplied = jpPrivileges.getSelectedIndexes();
+ 				int[] justAppliedOptions = jpPrivileges.getSelectedSecondaryIndexes();
                  jpPrivileges.reset();
                  jpPrivileges.setSelectedBoxes(justApplied, true);
+ 				jpPrivileges.setSelectedSecondaryBoxes(justAppliedOptions, true);
                  
          } catch (ObjectUpdateException e) {
  		e.printStackTrace();
***************
*** 434,444 ****
                  } else if (invocationNode instanceof TableNode) {
                      dbmd = this.backendClient.getAdminDatabaseMetaData(((TableNode) invocationNode).getParentClusterName(), ((TableNode) invocationNode).getParentDatabaseName());
                      String[][] tablePrivileges = backendClient.resultSetToStringArray(dbmd.getTablePrivileges(null, ((TableNode) invocationNode).getParentSchemaName(), invocationNode.toString()), (new ProcessLease()));
! 					objPrivileges = new String[tablePrivileges.length][2];
  
  					for (int i=0; i < tablePrivileges.length; i++) {
  						objPrivileges[i][0] = tablePrivileges[i][4];
  						objPrivileges[i][1] = tablePrivileges[i][5];
  					}
  					
                  } else if (invocationNode instanceof ViewNode) {
--- 495,509 ----
                  } else if (invocationNode instanceof TableNode) {
                      dbmd = this.backendClient.getAdminDatabaseMetaData(((TableNode) invocationNode).getParentClusterName(), ((TableNode) invocationNode).getParentDatabaseName());
                      String[][] tablePrivileges = backendClient.resultSetToStringArray(dbmd.getTablePrivileges(null, ((TableNode) invocationNode).getParentSchemaName(), invocationNode.toString()), (new ProcessLease()));
! 					objPrivileges = new String[tablePrivileges.length][4];
  
  					for (int i=0; i < tablePrivileges.length; i++) {
  						objPrivileges[i][0] = tablePrivileges[i][4];
  						objPrivileges[i][1] = tablePrivileges[i][5];
+ 						
+ 						// [i][2] would be GRANTOR.. we don't care about that here, skip it
+ 						
+ 						objPrivileges[i][3] = tablePrivileges[i][6];
  					}
  					
                  } else if (invocationNode instanceof ViewNode) {
***************
*** 494,506 ****
                      jpPrivileges.reset();
                      if (selectedUsers.length == 1) {
                          for (int i = 0; i < objPriv.length; i++) {
!                             if (objPriv[i][0].equals(selectedUsers[0].toString()))
                                  jpPrivileges.setSelectedBox(objPriv[i][1], true);
                          }
                      } else {
                          for (int i = 0; i < objPriv.length; i++) 
!                             if (objPriv[i][0].equals("group " + selectedGroups[0].toString()))
                                  jpPrivileges.setSelectedBox(objPriv[i][1], true);
                      }
                      jbApply.setEnabled(false);
                  }    
--- 559,579 ----
                      jpPrivileges.reset();
                      if (selectedUsers.length == 1) {
                          for (int i = 0; i < objPriv.length; i++) {
!                             if (objPriv[i][0].equals(selectedUsers[0].toString())) {
                                  jpPrivileges.setSelectedBox(objPriv[i][1], true);
+ 								
+ 								if (objPriv[i][3].equals("YES"))
+ 									jpPrivileges.setSelectedSecondaryBox(objPriv[i][1], true);
+ 							}
                          }
                      } else {
                          for (int i = 0; i < objPriv.length; i++) 
!                             if (objPriv[i][0].equals("group " + selectedGroups[0].toString())) {
                                  jpPrivileges.setSelectedBox(objPriv[i][1], true);
+ 								
+ 								if (objPriv[i][3].equals("YES"))
+ 									jpPrivileges.setSelectedSecondaryBox(objPriv[i][1], true);
+ 							}
                      }
                      jbApply.setEnabled(false);
                  }    
***************
*** 516,530 ****
              String[][] objPriv = getPrivileges();
              jpPrivileges.reset();
              for (int i = 0; i < objPriv.length; i++) 
!                 if (objPriv[i][0].equals("PUBLIC"))
                      jpPrivileges.setSelectedBox(objPriv[i][1], true);
              jbApply.setEnabled(false);
          } else {
              // PUBLIC and list selection
              jpPrivileges.setEnabled(true);
              jpPrivileges.reset();
          }
-                
      }
      
      private AdminBackendClient backendClient;
--- 589,606 ----
              String[][] objPriv = getPrivileges();
              jpPrivileges.reset();
              for (int i = 0; i < objPriv.length; i++) 
!                 if (objPriv[i][0].equals("PUBLIC")) {
                      jpPrivileges.setSelectedBox(objPriv[i][1], true);
+ 
+ 					if (objPriv[i][3].equals("YES"))
+ 						jpPrivileges.setSelectedSecondaryBox(objPriv[i][1], true);
+ 				}
              jbApply.setEnabled(false);
          } else {
              // PUBLIC and list selection
              jpPrivileges.setEnabled(true);
              jpPrivileges.reset();
          }
      }
      
      private AdminBackendClient backendClient;
***************
*** 533,539 ****
      private GenericAction applyAction;
      private GenericAction cancelAction;
      private String[] privileges = new String[0];
!     
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JButton jbApply;
      private javax.swing.JButton jbCancel;
--- 609,616 ----
      private GenericAction applyAction;
      private GenericAction cancelAction;
      private String[] privileges = new String[0];
! 	private String grantOptionString = "";
! 
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JButton jbApply;
      private javax.swing.JButton jbCancel;
***************
*** 545,551 ****
      private javax.swing.JLabel jlbUsers;
      private javax.swing.JPanel jpButtons;
      private javax.swing.JPanel jpOptions;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpPrivileges;
      private javax.swing.JScrollPane jspGroups;
      private javax.swing.JScrollPane jspUsers;
      // End of variables declaration//GEN-END:variables
--- 622,628 ----
      private javax.swing.JLabel jlbUsers;
      private javax.swing.JPanel jpButtons;
      private javax.swing.JPanel jpOptions;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpPrivileges;
      private javax.swing.JScrollPane jspGroups;
      private javax.swing.JScrollPane jspUsers;
      // End of variables declaration//GEN-END:variables
Index: src/com/redhat/rhdb/admin/ManagePrivilegesDialog.form
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/ManagePrivilegesDialog.form,v
retrieving revision 1.1
diff -c -r1.1 ManagePrivilegesDialog.form
*** src/com/redhat/rhdb/admin/ManagePrivilegesDialog.form	14 Jan 2004 00:53:50 -0000	1.1
--- src/com/redhat/rhdb/admin/ManagePrivilegesDialog.form	9 Jun 2004 05:39:22 -0000
***************
*** 48,60 ****
              </Constraint>
            </Constraints>
          </Component>
!         <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpDatabasePriv">
            <Events>
              <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="databasePrivilegeChange"/>
            </Events>
            <AuxValues>
              <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpDatabasePriv.setEnabled(false);"/>
!             <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(dbOptions, CheckBoxPanel.VERTICAL);"/>
            </AuxValues>
            <Constraints>
              <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
--- 48,60 ----
              </Constraint>
            </Constraints>
          </Component>
!         <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpDatabasePriv">
            <Events>
              <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="databasePrivilegeChange"/>
            </Events>
            <AuxValues>
              <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpDatabasePriv.setEnabled(false);"/>
!             <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(dbOptions, &quot;&quot;, grantOptionString);"/>
            </AuxValues>
            <Constraints>
              <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
***************
*** 97,109 ****
              </Constraint>
            </Constraints>
          </Component>
!         <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpSchemaPriv">
            <Events>
              <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="schemaPrivilegeChange"/>
            </Events>
            <AuxValues>
              <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpSchemaPriv.setEnabled(false);"/>
!             <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(schOptions, CheckBoxPanel.VERTICAL);"/>
            </AuxValues>
            <Constraints>
              <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
--- 97,109 ----
              </Constraint>
            </Constraints>
          </Component>
!         <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpSchemaPriv">
            <Events>
              <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="schemaPrivilegeChange"/>
            </Events>
            <AuxValues>
              <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpSchemaPriv.setEnabled(false);"/>
!             <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(schOptions, &quot;&quot;, grantOptionString);"/>
            </AuxValues>
            <Constraints>
              <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
***************
*** 166,178 ****
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpTablePriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="tablePrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpTablePriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(options, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
--- 166,178 ----
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpTablePriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="tablePrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpTablePriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(options, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
***************
*** 226,238 ****
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpViewPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="viewPrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpViewPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(options, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
--- 226,238 ----
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpViewPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="viewPrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpViewPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(options, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
***************
*** 286,298 ****
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpSequencesPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="sequencePrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpSequencesPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(options, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
--- 286,298 ----
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpSequencesPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="sequencePrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpSequencesPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(options, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
***************
*** 346,358 ****
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpLanguagesPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="languagePrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpLanguagesPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(langOptions, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
--- 346,358 ----
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpLanguagesPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="languagePrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpLanguagesPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(langOptions, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
***************
*** 406,418 ****
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.CheckBoxPanel" name="jpFunctionPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="functionPrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpFunctionPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckBoxPanel(funcOptions, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
--- 406,418 ----
                  </Component>
                </SubComponents>
              </Container>
!             <Container class="com.redhat.rhdb.admin.PrivilegesCheckBoxPanel" name="jpFunctionPriv">
                <Events>
                  <EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="functionPrivilegeChange"/>
                </Events>
                <AuxValues>
                  <AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="jpFunctionPriv.setEnabled(false);"/>
!                 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PrivilegesCheckBoxPanel(funcOptions, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);"/>
                </AuxValues>
                <Constraints>
                  <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
Index: src/com/redhat/rhdb/admin/ManagePrivilegesDialog.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/ManagePrivilegesDialog.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 ManagePrivilegesDialog.java
*** src/com/redhat/rhdb/admin/ManagePrivilegesDialog.java	21 Nov 2003 18:30:23 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/ManagePrivilegesDialog.java	9 Jun 2004 05:39:23 -0000
***************
*** 1,5 ****
  /**
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /**
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 72,77 ****
--- 72,82 ----
  		cancelAction = af.getAction(ActionFactory.ACTION_CANCEL);
  		applyAction = af.getAction(ActionFactory.ACTION_APPLY);
  		
+ 		// Only MANAGE USERS should have WITH GRANT OPTION option..
+ 		
+ 		if (invocationNode instanceof UserNode)
+ 			grantOptionString = dbmd.getGrantOptionString();	
+ 		
          initComponents();
  		
                  // Add databases to combo box
***************
*** 107,137 ****
  
          jpDatabase = new javax.swing.JPanel();
          jcbDatabase = new com.redhat.rhdb.admin.AdminComboBox();
!         jpDatabasePriv = new CheckBoxPanel(dbOptions, CheckBoxPanel.VERTICAL);
          jpSchema = new javax.swing.JPanel();
          jcbSchema = new com.redhat.rhdb.admin.AdminComboBox();
!         jpSchemaPriv = new CheckBoxPanel(schOptions, CheckBoxPanel.VERTICAL);
          jtpObjects = new javax.swing.JTabbedPane();
          jspTables = new javax.swing.JSplitPane();
          jscTables = new javax.swing.JScrollPane();
          jlTables = new javax.swing.JList();
!         jpTablePriv = new CheckBoxPanel(options, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));
          jspViews = new javax.swing.JSplitPane();
          jscViews = new javax.swing.JScrollPane();
          jlViews = new javax.swing.JList();
!         jpViewPriv = new CheckBoxPanel(options, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));
          jspSequences = new javax.swing.JSplitPane();
          jscSequences = new javax.swing.JScrollPane();
          jlSequences = new javax.swing.JList();
!         jpSequencesPriv = new CheckBoxPanel(options, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));
          jspLanguages = new javax.swing.JSplitPane();
          jscLanguages = new javax.swing.JScrollPane();
          jlLanguages = new javax.swing.JList();
!         jpLanguagesPriv = new CheckBoxPanel(langOptions, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));
          jspFunctions = new javax.swing.JSplitPane();
          jscFunctions = new javax.swing.JScrollPane();
          jlFunctions = new javax.swing.JList();
!         jpFunctionPriv = new CheckBoxPanel(funcOptions, CheckBoxPanel.VERTICAL, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES));
          jpButtons = new javax.swing.JPanel();
          jbOK = okAction.getButton();
          jbApply = applyAction.getButton();
--- 112,142 ----
  
          jpDatabase = new javax.swing.JPanel();
          jcbDatabase = new com.redhat.rhdb.admin.AdminComboBox();
!         jpDatabasePriv = new PrivilegesCheckBoxPanel(dbOptions, "", grantOptionString);
          jpSchema = new javax.swing.JPanel();
          jcbSchema = new com.redhat.rhdb.admin.AdminComboBox();
!         jpSchemaPriv = new PrivilegesCheckBoxPanel(schOptions, "", grantOptionString);
          jtpObjects = new javax.swing.JTabbedPane();
          jspTables = new javax.swing.JSplitPane();
          jscTables = new javax.swing.JScrollPane();
          jlTables = new javax.swing.JList();
!         jpTablePriv = new PrivilegesCheckBoxPanel(options, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);
          jspViews = new javax.swing.JSplitPane();
          jscViews = new javax.swing.JScrollPane();
          jlViews = new javax.swing.JList();
!         jpViewPriv = new PrivilegesCheckBoxPanel(options, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);
          jspSequences = new javax.swing.JSplitPane();
          jscSequences = new javax.swing.JScrollPane();
          jlSequences = new javax.swing.JList();
!         jpSequencesPriv = new PrivilegesCheckBoxPanel(options, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);
          jspLanguages = new javax.swing.JSplitPane();
          jscLanguages = new javax.swing.JScrollPane();
          jlLanguages = new javax.swing.JList();
!         jpLanguagesPriv = new PrivilegesCheckBoxPanel(langOptions, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);
          jspFunctions = new javax.swing.JSplitPane();
          jscFunctions = new javax.swing.JScrollPane();
          jlFunctions = new javax.swing.JList();
!         jpFunctionPriv = new PrivilegesCheckBoxPanel(funcOptions, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_PRIVILEGES), grantOptionString);
          jpButtons = new javax.swing.JPanel();
          jbOK = okAction.getButton();
          jbApply = applyAction.getButton();
***************
*** 380,387 ****
  
      private void languagePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_languagePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
!             if (jpLanguagesPriv.getChangedIndexes().length != 0 || jlLanguages.getSelectedIndices().length > 0) {
                  jtpObjects.setTitleAt(3, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_LANGUAGES) + " *");
                  jbApply.setEnabled(true);
                  langPrivChanged = true;
--- 385,392 ----
  
      private void languagePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_languagePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
!             if (jpLanguagesPriv.getChangedIndexes().length != 0 || jlLanguages.getSelectedIndices().length > 1) {
                  jtpObjects.setTitleAt(3, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_LANGUAGES) + " *");
                  jbApply.setEnabled(true);
                  langPrivChanged = true;
***************
*** 395,402 ****
  
      private void functionPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_functionPrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
!             if (jpFunctionPriv.getChangedIndexes().length != 0 || jlFunctions.getSelectedIndices().length > 0) {
                  jtpObjects.setTitleAt(4, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_FUNCTIONS) + " *");
                  jbApply.setEnabled(true);
                  funcPrivChanged = true;
--- 400,407 ----
  
      private void functionPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_functionPrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
!             if (jpFunctionPriv.getChangedIndexes().length != 0 || jlFunctions.getSelectedIndices().length > 1) {
                  jtpObjects.setTitleAt(4, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_FUNCTIONS) + " *");
                  jbApply.setEnabled(true);
                  funcPrivChanged = true;
***************
*** 410,417 ****
  
      private void sequencePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_sequencePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
!             if (jpSequencesPriv.getChangedIndexes().length != 0 || jlSequences.getSelectedIndices().length > 0) {
                  jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES) + " *");
                  jbApply.setEnabled(true);
                  seqPrivChanged = true;
--- 415,422 ----
  
      private void sequencePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_sequencePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
!             if (jpSequencesPriv.getChangedIndexes().length != 0 || jlSequences.getSelectedIndices().length > 1) {
                  jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES) + " *");
                  jbApply.setEnabled(true);
                  seqPrivChanged = true;
***************
*** 425,432 ****
  
      private void viewPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_viewPrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
!             if (jpViewPriv.getChangedIndexes().length != 0 || jlViews.getSelectedIndices().length > 0) {
                  jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS) + " *");
                  jbApply.setEnabled(true);
                  viewPrivChanged = true;
--- 430,437 ----
  
      private void viewPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_viewPrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
!             if (jpViewPriv.getChangedIndexes().length != 0 || jlViews.getSelectedIndices().length > 1) {
                  jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS) + " *");
                  jbApply.setEnabled(true);
                  viewPrivChanged = true;
***************
*** 440,447 ****
  
      private void tablePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_tablePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
!             if (jpTablePriv.getChangedIndexes().length != 0 || jlTables.getSelectedIndices().length > 0) {
                  jtpObjects.setTitleAt(0, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_TABLES) + " *");
                  jbApply.setEnabled(true);
                  tablePrivChanged = true;
--- 445,452 ----
  
      private void tablePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_tablePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
!             if (jpTablePriv.getChangedIndexes().length != 0 || jlTables.getSelectedIndices().length > 1) {
                  jtpObjects.setTitleAt(0, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_TABLES) + " *");
                  jbApply.setEnabled(true);
                  tablePrivChanged = true;
***************
*** 455,461 ****
  
      private void schemaPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_schemaPrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
              if (jpSchemaPriv.getChangedIndexes().length != 0) {
                  jpSchema.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SCHEMA) + " *"));
                  jbApply.setEnabled(true);
--- 460,466 ----
  
      private void schemaPrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_schemaPrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
              if (jpSchemaPriv.getChangedIndexes().length != 0) {
                  jpSchema.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SCHEMA) + " *"));
                  jbApply.setEnabled(true);
***************
*** 470,476 ****
  
      private void databasePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_databasePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == CheckBoxPanel.SELECTION_MADE) {
              if (jpDatabasePriv.getChangedIndexes().length != 0) {
                  jpDatabase.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_DATABASE) + " *"));
                  jbApply.setEnabled(true);
--- 475,481 ----
  
      private void databasePrivilegeChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_databasePrivilegeChange
          // Add your handling code here:
!         if (evt.getPropertyName() == PrivilegesCheckBoxPanel.SELECTION_MADE) {
              if (jpDatabasePriv.getChangedIndexes().length != 0) {
                  jpDatabase.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_DATABASE) + " *"));
                  jbApply.setEnabled(true);
***************
*** 562,570 ****
  			
  		for (int i=0; i < privOfSelectedSchema.length; i++) {
  			if (name.compareTo( privOfSelectedSchema[i][0]) == 0) {					
! 				for (int j=1; j<privOfSelectedSchema[i].length; j++) {
! 					jpSchemaPriv.setSelectedBox(privOfSelectedSchema[i][j], true);
! 				}
  			}					
  		}
  			
--- 567,577 ----
  			
  		for (int i=0; i < privOfSelectedSchema.length; i++) {
  			if (name.compareTo( privOfSelectedSchema[i][0]) == 0) {					
! 				jpSchemaPriv.setSelectedBox(privOfSelectedSchema[i][1], true);
! 				
! 				if (privOfSelectedSchema[i][3].equals("YES"))
! 					jpSchemaPriv.setSelectedSecondaryBox(privOfSelectedSchema[i][1], true);
! 				
  			}					
  		}
  			
***************
*** 667,675 ****
                  
  		for (int i=0; i < privOfSelectedDatabase.length; i++) {
  			if (name.compareTo( privOfSelectedDatabase[i][0]) == 0) {					
! 				for (int j=1; j<privOfSelectedDatabase[i].length; j++) {
! 					jpDatabasePriv.setSelectedBox(privOfSelectedDatabase[i][j], true);
  				}
  			}					
  		}
  			
--- 674,685 ----
                  
  		for (int i=0; i < privOfSelectedDatabase.length; i++) {
  			if (name.compareTo( privOfSelectedDatabase[i][0]) == 0) {					
! 				jpDatabasePriv.setSelectedBox(privOfSelectedDatabase[i][1], true);
! 
! 				if (privOfSelectedDatabase[i][3].equals("YES")) {
! 					jpDatabasePriv.setSelectedSecondaryBox(privOfSelectedDatabase[i][1], true);
  				}
+ 
  			}					
  		}
  			
***************
*** 743,749 ****
  			for (int i=0; i < privOfSelectedFunction.length; i++) {
  				
  				if (name.compareTo( privOfSelectedFunction[i][0]) == 0) {
! 					jpFunctionPriv.setSelectedBox(privOfSelectedFunction[i][1], true);					
  				}					
  								
  			}
--- 753,763 ----
  			for (int i=0; i < privOfSelectedFunction.length; i++) {
  				
  				if (name.compareTo( privOfSelectedFunction[i][0]) == 0) {
! 					jpFunctionPriv.setSelectedBox(privOfSelectedFunction[i][1], true);
! 
! 					if (privOfSelectedFunction[i][3].equals("YES")) {
! 						jpFunctionPriv.setSelectedSecondaryBox(privOfSelectedFunction[i][1], true);
! 					}
  				}					
  								
  			}
***************
*** 806,812 ****
  			
  			for (int i=0; i < privOfSelectedLanguage.length; i++) {	
  				if (name.compareTo( privOfSelectedLanguage[i][0]) == 0) {					
! 					jpLanguagesPriv.setSelectedBox(privOfSelectedLanguage[i][1], true);					
  				}					
  			}
  			
--- 820,830 ----
  			
  			for (int i=0; i < privOfSelectedLanguage.length; i++) {	
  				if (name.compareTo( privOfSelectedLanguage[i][0]) == 0) {					
! 					jpLanguagesPriv.setSelectedBox(privOfSelectedLanguage[i][1], true);
! 
! 					if (privOfSelectedLanguage[i][3].equals("YES")) {
! 						jpLanguagesPriv.setSelectedSecondaryBox(privOfSelectedLanguage[i][1], true);
! 					}
  				}					
  			}
  			
***************
*** 860,873 ****
  		
  		try {
  			AdminDatabaseMetaData dbmd = this.backendClient.getAdminDatabaseMetaData(cluster,database);
!         	        String[][] privOfSelectedSequence = backendClient.resultSetToStringArray(dbmd.getSequencePrivileges(schema,sequence), (new ProcessLease()));
  			
  			for (int i=0; i < privOfSelectedSequence.length; i++) {
! 				if (name.compareTo( privOfSelectedSequence[i][0]) == 0) {					
! 					for (int j=1; j<privOfSelectedSequence[i].length; j++) {
! 						jpSequencesPriv.setSelectedBox(privOfSelectedSequence[i][j], true);
  					}
! 				}					
  			}
  			
  		} catch (Exception e) {
--- 878,893 ----
  		
  		try {
  			AdminDatabaseMetaData dbmd = this.backendClient.getAdminDatabaseMetaData(cluster,database);
! 			String[][] privOfSelectedSequence = backendClient.resultSetToStringArray(dbmd.getSequencePrivileges(schema,sequence), (new ProcessLease()));
  			
  			for (int i=0; i < privOfSelectedSequence.length; i++) {
! 				if (name.compareTo( privOfSelectedSequence[i][0]) == 0) {
! 					jpSequencesPriv.setSelectedBox(privOfSelectedSequence[i][1], true);
! 					
! 					if (privOfSelectedSequence[i][3].equals("YES")) {
! 						jpSequencesPriv.setSelectedSecondaryBox(privOfSelectedSequence[i][1], true);
  					}
! 				}
  			}
  			
  		} catch (Exception e) {
***************
*** 875,892 ****
  			displayError(e.getMessage());
  		}
  		
!             } else if (jlSequences.getSelectedIndices().length > 1) {
  				jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES) + " *");
!                 jbApply.setEnabled(true);
!                 seqPrivChanged = true;
  			}
!         } else {
!             jpSequencesPriv.setEnabled(false);
!             jpSequencesPriv.reset();
!             seqPrivChanged = false;
!             jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES));
!             updateApplyStatus();
!         }
      }//GEN-LAST:event_sequenceSelected
  
      private void viewSelected(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_viewSelected
--- 895,912 ----
  			displayError(e.getMessage());
  		}
  		
! 			} else if (jlSequences.getSelectedIndices().length > 1) {
  				jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES) + " *");
! 				jbApply.setEnabled(true);
! 				seqPrivChanged = true;
  			}
! 		} else {
! 			jpSequencesPriv.setEnabled(false);
! 			jpSequencesPriv.reset();
! 			seqPrivChanged = false;
! 			jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES));
! 			updateApplyStatus();
! 		}
      }//GEN-LAST:event_sequenceSelected
  
      private void viewSelected(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_viewSelected
***************
*** 922,957 ****
  		
  		try {
  			AdminDatabaseMetaData dbmd = this.backendClient.getAdminDatabaseMetaData(cluster,database);
!         	        String[][] privOfSelectedView = backendClient.resultSetToStringArray(dbmd.getViewPrivileges(schema,view), (new ProcessLease()));
! 			
! 			
! 			
  			for (int i=0; i < privOfSelectedView.length; i++) {
  				if (name.compareTo( privOfSelectedView[i][0]) == 0) {
! 					for (int j=1; j<privOfSelectedView[i].length; j++) {
! 						jpViewPriv.setSelectedBox(privOfSelectedView[i][j], true);
  					}
! 				}					
  			}
  			
- 			
  		} catch (Exception e) {
  			e.printStackTrace();
  			displayError(e.getMessage());
  		}
! 
!             } else if (jlViews.getSelectedIndices().length > 1) {
  				jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS) + " *");
!                 jbApply.setEnabled(true);
!                 viewPrivChanged = true;
  			}
!         } else {
!             jpViewPriv.setEnabled(false);
!             jpViewPriv.reset();
!             viewPrivChanged = false;
!             jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS));
!             updateApplyStatus();
!         }
      }//GEN-LAST:event_viewSelected
  
      private void tableSelected(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_tableSelected
--- 942,976 ----
  		
  		try {
  			AdminDatabaseMetaData dbmd = this.backendClient.getAdminDatabaseMetaData(cluster,database);
! 			String[][] privOfSelectedView = backendClient.resultSetToStringArray(dbmd.getViewPrivileges(schema,view), (new ProcessLease()));
! 
  			for (int i=0; i < privOfSelectedView.length; i++) {
  				if (name.compareTo( privOfSelectedView[i][0]) == 0) {
! 					jpViewPriv.setSelectedBox(privOfSelectedView[i][1], true);
! 					
! 					if (privOfSelectedView[i][3].equals("YES")) {
! 						jpViewPriv.setSelectedSecondaryBox(privOfSelectedView[i][1], true);
  					}
! 				}
  			}
  			
  		} catch (Exception e) {
  			e.printStackTrace();
  			displayError(e.getMessage());
  		}
! 		
! 			} else if (jlViews.getSelectedIndices().length > 1) {
  				jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS) + " *");
! 				jbApply.setEnabled(true);
! 				viewPrivChanged = true;
  			}
! 		} else {
! 			jpViewPriv.setEnabled(false);
! 			jpViewPriv.reset();
! 			viewPrivChanged = false;
! 			jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS));
! 			updateApplyStatus();
! 		}
      }//GEN-LAST:event_viewSelected
  
      private void tableSelected(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_tableSelected
***************
*** 987,1006 ****
  		
  		try {
  			AdminDatabaseMetaData dbmd = this.backendClient.getAdminDatabaseMetaData(cluster,database);
!         	        String[][] privOfSelectedTable = backendClient.resultSetToStringArray(dbmd.getTablePrivileges(null, schema, table), (new ProcessLease()));
  	
  			for (int i=0; i < privOfSelectedTable.length; i++) {
! 				
! 				if (privOfSelectedTable[i][4] == null)
! 					continue;
! 				
! 				for (int k=i+1; k < privOfSelectedTable.length; k++) {
  						
! 					if (privOfSelectedTable[k][4] != null && privOfSelectedTable[k][4].equals(name)) {
! 						jpTablePriv.setSelectedBox(privOfSelectedTable[k][5], true);
  					}
  				}
- 						
  			}
  			
  			
--- 1006,1021 ----
  		
  		try {
  			AdminDatabaseMetaData dbmd = this.backendClient.getAdminDatabaseMetaData(cluster,database);
! 			String[][] privOfSelectedTable = backendClient.resultSetToStringArray(dbmd.getTablePrivileges(null, schema, table), (new ProcessLease()));
  	
  			for (int i=0; i < privOfSelectedTable.length; i++) {
! 				if (name.compareTo( privOfSelectedTable[i][4]) == 0) {
! 					jpTablePriv.setSelectedBox(privOfSelectedTable[i][5], true);
  						
! 					if (privOfSelectedTable[i][6].equals("YES")) {
! 						jpTablePriv.setSelectedSecondaryBox(privOfSelectedTable[i][5], true);
  					}
  				}
  			}
  			
  			
***************
*** 1115,1132 ****
  	
  	if (dbPrivChanged) {
  		
! 		String[] effectedPriveleges = jpDatabasePriv.getSelectedBoxes();
  		
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
!         	for (int i = 0; i < effectedPriveleges.length; i++) {
!             		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  		
  		parameters.put(ObjectUpdate.PARAM_DATABASE_PRIVILEGES, privSet);
  
- 	       
  		// Create new set including database that was effected
  		
  		Hashtable databaseSet = new Hashtable();		
--- 1130,1154 ----
  	
  	if (dbPrivChanged) {
  		
! 		String[] effectedPriveleges = jpDatabasePriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpDatabasePriv.getSelectedSecondaryBoxes();
  		
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
!         for (int i = 0; i < effectedPriveleges.length; i++) {
! 			privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
! 		}
! 		
! 		Hashtable withGrantPrivSet = new Hashtable();
! 		
! 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
! 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
  		}
  		
  		parameters.put(ObjectUpdate.PARAM_DATABASE_PRIVILEGES, privSet);
+ 		parameters.put(ObjectUpdate.PARAM_DATABASE_PRIVILEGES_WITH_GRANT, withGrantPrivSet);
  
  		// Create new set including database that was effected
  		
  		Hashtable databaseSet = new Hashtable();		
***************
*** 1141,1147 ****
  	
  	if (schemaPrivChanged) {
  		
! 		String[] effectedPriveleges = jpSchemaPriv.getSelectedBoxes();
  		
  		// Create new set including the privileges that were effected
          	
--- 1163,1170 ----
  	
  	if (schemaPrivChanged) {
  		
! 		String[] effectedPriveleges = jpSchemaPriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpSchemaPriv.getSelectedSecondaryBoxes();
  		
  		// Create new set including the privileges that were effected
          	
***************
*** 1150,1156 ****
--- 1173,1186 ----
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  		
+ 		Hashtable withGrantPrivSet = new Hashtable();
+ 		
+ 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
+ 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
+ 		}
+ 		
  		parameters.put(ObjectUpdate.PARAM_SCHEMA_PRIVILEGES, privSet);
+ 		parameters.put(ObjectUpdate.PARAM_SCHEMA_PRIVILEGES_WITH_GRANT, withGrantPrivSet);
  
  	       
  		// Create new set including schema that were effected
***************
*** 1167,1174 ****
  	
  	if (tablePrivChanged) {
  		
! 		String[] effectedPriveleges = jpTablePriv.getSelectedBoxes();
! 		
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
--- 1197,1205 ----
  	
  	if (tablePrivChanged) {
  		
! 		String[] effectedPriveleges = jpTablePriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpTablePriv.getSelectedSecondaryBoxes();
! 
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
***************
*** 1176,1183 ****
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  		
  		parameters.put(ObjectUpdate.PARAM_TABLE_PRIVILEGES, privSet);
! 
  	       
  		// Create new set including tables that were effected
  		
--- 1207,1220 ----
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  		
+ 		Hashtable withGrantPrivSet = new Hashtable();
+ 		
+ 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
+ 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
+ 		}
+ 		
  		parameters.put(ObjectUpdate.PARAM_TABLE_PRIVILEGES, privSet);
! 		parameters.put(ObjectUpdate.PARAM_TABLE_PRIVILEGES_WITH_GRANT, withGrantPrivSet);
  	       
  		// Create new set including tables that were effected
  		
***************
*** 1196,1203 ****
  	
  	if (viewPrivChanged) {
  		
! 		String[] effectedPriveleges = jpViewPriv.getSelectedBoxes();
! 		
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
--- 1233,1241 ----
  	
  	if (viewPrivChanged) {
  		
! 		String[] effectedPriveleges = jpViewPriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpViewPriv.getSelectedSecondaryBoxes();
! 
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
***************
*** 1205,1212 ****
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  		
  		parameters.put(ObjectUpdate.PARAM_VIEW_PRIVILEGES, privSet);
! 
  	       
  		// Create new set including views that were effected
  		
--- 1243,1256 ----
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  		
+ 		Hashtable withGrantPrivSet = new Hashtable();
+ 		
+ 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
+ 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
+ 		}
+ 		
  		parameters.put(ObjectUpdate.PARAM_VIEW_PRIVILEGES, privSet);
! 		parameters.put(ObjectUpdate.PARAM_VIEW_PRIVILEGES_WITH_GRANT, withGrantPrivSet);
  	       
  		// Create new set including views that were effected
  		
***************
*** 1226,1233 ****
  	
  	if (seqPrivChanged) {
  
! 		String[] effectedPriveleges = jpSequencesPriv.getSelectedBoxes();
! 		
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
--- 1270,1278 ----
  	
  	if (seqPrivChanged) {
  
! 		String[] effectedPriveleges = jpSequencesPriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpSequencesPriv.getSelectedSecondaryBoxes();
! 
  		// Create new set including the privileges that were effected
          	
  		Hashtable privSet = new Hashtable();
***************
*** 1236,1243 ****
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  	
  		parameters.put(ObjectUpdate.PARAM_SEQUENCE_PRIVILEGES, privSet);
! 
  	        
  		// Get all the selected sequences
  		
--- 1281,1294 ----
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  	
+ 		Hashtable withGrantPrivSet = new Hashtable();
+ 		
+ 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
+ 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
+ 		}
+ 		
  		parameters.put(ObjectUpdate.PARAM_SEQUENCE_PRIVILEGES, privSet);
! 		parameters.put(ObjectUpdate.PARAM_SEQUENCE_PRIVILEGES_WITH_GRANT, withGrantPrivSet);
  	        
  		// Get all the selected sequences
  		
***************
*** 1257,1263 ****
  	
  	if (langPrivChanged) {
  
! 		String[] effectedPriveleges = jpLanguagesPriv.getSelectedBoxes();
  		
  		// Create new set including the privileges that were effected
          	
--- 1308,1315 ----
  	
  	if (langPrivChanged) {
  
! 		String[] effectedPriveleges = jpLanguagesPriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpLanguagesPriv.getSelectedSecondaryBoxes();
  		
  		// Create new set including the privileges that were effected
          	
***************
*** 1267,1274 ****
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  	
  		parameters.put(ObjectUpdate.PARAM_LANGUAGE_PRIVILEGES, privSet);
! 	        
  		
  		// Get all the selected items s
  		
--- 1319,1332 ----
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  	
+ 		Hashtable withGrantPrivSet = new Hashtable();
+ 		
+ 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
+ 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
+ 		}
+ 		
  		parameters.put(ObjectUpdate.PARAM_LANGUAGE_PRIVILEGES, privSet);
! 		parameters.put(ObjectUpdate.PARAM_LANGUAGE_PRIVILEGES_WITH_GRANT, withGrantPrivSet);  
  		
  		// Get all the selected items s
  		
***************
*** 1287,1294 ****
  	
  	if (funcPrivChanged) {
  		
! 		String[] effectedPriveleges = jpFunctionPriv.getSelectedBoxes();
! 		
  		
  		// Create new set including the privileges that were effected
          	
--- 1345,1352 ----
  	
  	if (funcPrivChanged) {
  		
! 		String[] effectedPriveleges = jpFunctionPriv.getPrimaryOnlySelectedBoxes();
! 		String[] effectedWithGrantPrivileges = jpFunctionPriv.getSelectedSecondaryBoxes();
  		
  		// Create new set including the privileges that were effected
          	
***************
*** 1298,1305 ****
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  	
  		parameters.put(ObjectUpdate.PARAM_FUNCTION_PRIVILEGES, privSet);
! 	        
  		
  		// Get all the selected items s
  		
--- 1356,1370 ----
              		privSet.put(effectedPriveleges[i], effectedPriveleges[i]);
  		}
  	
+ 		Hashtable withGrantPrivSet = new Hashtable();
+ 		
+ 		for (int i = 0; i < effectedWithGrantPrivileges.length; i++) {
+ 			withGrantPrivSet.put(effectedWithGrantPrivileges[i], effectedWithGrantPrivileges[i]);
+ 		}
+ 		
  		parameters.put(ObjectUpdate.PARAM_FUNCTION_PRIVILEGES, privSet);
! 		parameters.put(ObjectUpdate.PARAM_FUNCTION_PRIVILEGES_WITH_GRANT, withGrantPrivSet);  
! 
  		
  		// Get all the selected items s
  		
***************
*** 1323,1354 ****
  		jbApply.setEnabled(false);
  		jtpObjects.setTitleAt(0, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_TABLES));
                  int[] justApplied = jpTablePriv.getSelectedIndexes();
                  jpTablePriv.reset();
                  jpTablePriv.setSelectedBoxes(justApplied, true);
  		jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS));
                  justApplied = jpViewPriv.getSelectedIndexes();
                  jpViewPriv.reset();
                  jpViewPriv.setSelectedBoxes(justApplied, true);
  		jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES));
                  justApplied = jpSequencesPriv.getSelectedIndexes();
                  jpSequencesPriv.reset();
                  jpSequencesPriv.setSelectedBoxes(justApplied, true);
  		jtpObjects.setTitleAt(3, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_LANGUAGES));
                  justApplied = jpLanguagesPriv.getSelectedIndexes();
                  jpLanguagesPriv.reset();
                  jpLanguagesPriv.setSelectedBoxes(justApplied, true);
  		jtpObjects.setTitleAt(4, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_FUNCTIONS));
                  justApplied = jpFunctionPriv.getSelectedIndexes();
!                 jpFunctionPriv.reset();
                  jpFunctionPriv.setSelectedBoxes(justApplied, true);
                  jpDatabase.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_DATABASE)));
                  justApplied = jpDatabasePriv.getSelectedIndexes();
!                 jpDatabasePriv.reset();
                  jpDatabasePriv.setSelectedBoxes(justApplied, true);
                  jpSchema.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SCHEMA)));
                  justApplied = jpSchemaPriv.getSelectedIndexes();
!                 jpSchemaPriv.reset();
                  jpSchemaPriv.setSelectedBoxes(justApplied, true);
                  
  	} catch (ObjectUpdateException e) {
  		e.printStackTrace();
--- 1388,1433 ----
  		jbApply.setEnabled(false);
  		jtpObjects.setTitleAt(0, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_TABLES));
                  int[] justApplied = jpTablePriv.getSelectedIndexes();
+ 				int[] justAppliedOptions = jpTablePriv.getSelectedSecondaryIndexes();
                  jpTablePriv.reset();
                  jpTablePriv.setSelectedBoxes(justApplied, true);
+ 				jpTablePriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
  		jtpObjects.setTitleAt(1, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_VIEWS));
                  justApplied = jpViewPriv.getSelectedIndexes();
+ 				justAppliedOptions = jpViewPriv.getSelectedSecondaryIndexes();
                  jpViewPriv.reset();
                  jpViewPriv.setSelectedBoxes(justApplied, true);
+ 				jpViewPriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
  		jtpObjects.setTitleAt(2, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SEQUENCES));
                  justApplied = jpSequencesPriv.getSelectedIndexes();
+ 				justAppliedOptions = jpSequencesPriv.getSelectedSecondaryIndexes();
                  jpSequencesPriv.reset();
                  jpSequencesPriv.setSelectedBoxes(justApplied, true);
+ 				jpSequencesPriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
  		jtpObjects.setTitleAt(3, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_LANGUAGES));
                  justApplied = jpLanguagesPriv.getSelectedIndexes();
+ 				justAppliedOptions = jpLanguagesPriv.getSelectedSecondaryIndexes();
                  jpLanguagesPriv.reset();
                  jpLanguagesPriv.setSelectedBoxes(justApplied, true);
+ 				jpLanguagesPriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
  		jtpObjects.setTitleAt(4, AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_FUNCTIONS));
                  justApplied = jpFunctionPriv.getSelectedIndexes();
!                 justAppliedOptions = jpFunctionPriv.getSelectedSecondaryIndexes();
! 				jpFunctionPriv.reset();
                  jpFunctionPriv.setSelectedBoxes(justApplied, true);
+ 				jpFunctionPriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
                  jpDatabase.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_DATABASE)));
                  justApplied = jpDatabasePriv.getSelectedIndexes();
!                 justAppliedOptions = jpDatabasePriv.getSelectedSecondaryIndexes();
! 				jpDatabasePriv.reset();
                  jpDatabasePriv.setSelectedBoxes(justApplied, true);
+ 				jpDatabasePriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
                  jpSchema.setBorder(new javax.swing.border.TitledBorder(AdminResources.getString(AdminResources.DLG_MANAGE_PRIVILEGES_SCHEMA)));
                  justApplied = jpSchemaPriv.getSelectedIndexes();
!                 justAppliedOptions = jpSchemaPriv.getSelectedSecondaryIndexes();
! 				jpSchemaPriv.reset();
                  jpSchemaPriv.setSelectedBoxes(justApplied, true);
+ 				jpSchemaPriv.setSelectedSecondaryBoxes(justAppliedOptions, true);
                  
  	} catch (ObjectUpdateException e) {
  		e.printStackTrace();
***************
*** 1386,1391 ****
--- 1465,1472 ----
      private static String[] funcOptions;
      private static String[] langOptions;
      private static String[] options;
+ 	
+ 	private String grantOptionString = "";
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JButton jbApply;
***************
*** 1400,1413 ****
      private javax.swing.JList jlViews;
      private javax.swing.JPanel jpButtons;
      private javax.swing.JPanel jpDatabase;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpDatabasePriv;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpFunctionPriv;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpLanguagesPriv;
      private javax.swing.JPanel jpSchema;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpSchemaPriv;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpSequencesPriv;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpTablePriv;
!     private com.redhat.rhdb.admin.CheckBoxPanel jpViewPriv;
      private javax.swing.JScrollPane jscFunctions;
      private javax.swing.JScrollPane jscLanguages;
      private javax.swing.JScrollPane jscSequences;
--- 1481,1494 ----
      private javax.swing.JList jlViews;
      private javax.swing.JPanel jpButtons;
      private javax.swing.JPanel jpDatabase;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpDatabasePriv;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpFunctionPriv;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpLanguagesPriv;
      private javax.swing.JPanel jpSchema;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpSchemaPriv;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpSequencesPriv;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpTablePriv;
!     private com.redhat.rhdb.admin.PrivilegesCheckBoxPanel jpViewPriv;
      private javax.swing.JScrollPane jscFunctions;
      private javax.swing.JScrollPane jscLanguages;
      private javax.swing.JScrollPane jscSequences;
Index: src/com/redhat/rhdb/admin/ObjectUpdate.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/ObjectUpdate.java,v
retrieving revision 1.2
diff -c -r1.2 ObjectUpdate.java
*** src/com/redhat/rhdb/admin/ObjectUpdate.java	4 May 2004 16:57:15 -0000	1.2
--- src/com/redhat/rhdb/admin/ObjectUpdate.java	9 Jun 2004 05:39:23 -0000
***************
*** 220,231 ****
--- 220,238 ----
  	public static final String PARAM_PUBLIC = "public";
  	
  	public static final String PARAM_DATABASE_PRIVILEGES = "database.privileges";
+ 	public static final String PARAM_DATABASE_PRIVILEGES_WITH_GRANT = "database.privileges.with.grant";
  	public static final String PARAM_SCHEMA_PRIVILEGES = "schema.privileges";
+ 	public static final String PARAM_SCHEMA_PRIVILEGES_WITH_GRANT = "schema.privileges.with.grant";
  	public static final String PARAM_TABLE_PRIVILEGES = "table.privileges";
+ 	public static final String PARAM_TABLE_PRIVILEGES_WITH_GRANT = "table.privileges.with.grant";
  	public static final String PARAM_VIEW_PRIVILEGES = "view.privileges";
+ 	public static final String PARAM_VIEW_PRIVILEGES_WITH_GRANT = "view.privileges.with.grant";
  	public static final String PARAM_SEQUENCE_PRIVILEGES = "sequence.privileges";
+ 	public static final String PARAM_SEQUENCE_PRIVILEGES_WITH_GRANT = "sequence.privileges.with.grant";
  	public static final String PARAM_LANGUAGE_PRIVILEGES = "language.privileges";
+ 	public static final String PARAM_LANGUAGE_PRIVILEGES_WITH_GRANT = "language.privileges.with.grant";
  	public static final String PARAM_FUNCTION_PRIVILEGES = "function.privileges";
+ 	public static final String PARAM_FUNCTION_PRIVILEGES_WITH_GRANT = "function.privileges.with.grant";
  	
  	public static final String PARAM_RULE_NAME = "rule.name";
  	public static final String PARAM_RELATION_NAME = "relation.name";
Index: src/com/redhat/rhdb/admin/PrivilegesUpdate.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/PrivilegesUpdate.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 PrivilegesUpdate.java
*** src/com/redhat/rhdb/admin/PrivilegesUpdate.java	21 Nov 2003 18:30:23 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/PrivilegesUpdate.java	9 Jun 2004 05:39:24 -0000
***************
*** 1,5 ****
  /**
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /**
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 149,155 ****
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_FUNCTIONS, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_FUNCTION_PRIVILEGES};
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String functionList = "";
--- 149,155 ----
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_FUNCTIONS, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_FUNCTION_PRIVILEGES, PARAM_FUNCTION_PRIVILEGES_WITH_GRANT };
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String functionList = "";
***************
*** 235,240 ****
--- 235,260 ----
  			
  		}
  		
+ 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_FUNCTION_PRIVILEGES_WITH_GRANT)).values().toArray();
+ 
+ 		if (privilegesWithGrant.length != 0) {
+ 		
+ 			// Add grant call
+ 			updateString += "GRANT ";
+ 		
+ 			for (int i = 0; i < privilegesWithGrant.length; i++) {
+ 		
+ 				updateString += privilegesWithGrant[i];
+ 			
+ 				if (i < privilegesWithGrant.length - 1)
+ 					updateString += ", ";
+ 					
+ 			}
+ 		
+ 			updateString += " ON FUNCTION " + functionList + " TO " + userList + " WITH GRANT OPTION; ";
+ 			
+ 		}
+ 		
  		return updateString;
  			
  			
***************
*** 343,348 ****
--- 363,388 ----
  			
  		}
  		
+ 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_LANGUAGE_PRIVILEGES_WITH_GRANT)).values().toArray();
+ 		
+ 		if (privilegesWithGrant.length != 0) {
+ 		
+ 			// Add grant call
+ 			updateString += "GRANT ";
+ 		
+ 			for (int i = 0; i < privilegesWithGrant.length; i++) {
+ 		
+ 				updateString += privilegesWithGrant[i];
+ 			
+ 				if (i < privilegesWithGrant.length - 1)
+ 					updateString += ", ";
+ 					
+ 			}
+ 		
+ 			updateString += " ON LANGUAGE " + languageList + " TO " + userList + " WITH GRANT OPTION; ";
+ 			
+ 		}
+ 		
  		return updateString;
  		
  	}
***************
*** 362,368 ****
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_VIEWS, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_VIEW_PRIVILEGES};
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String viewList = "";
--- 402,408 ----
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_VIEWS, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_VIEW_PRIVILEGES, PARAM_VIEW_PRIVILEGES_WITH_GRANT };
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String viewList = "";
***************
*** 451,457 ****
  			
  		}
  		
! 		return updateString;		
  	}
  
  
--- 491,517 ----
  			
  		}
  		
! 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_VIEW_PRIVILEGES_WITH_GRANT)).values().toArray();
! 		
! 		if (privilegesWithGrant.length != 0) {
! 		
! 			// Add grant call
! 			updateString += "GRANT ";
! 		
! 			for (int i = 0; i < privilegesWithGrant.length; i++) {
! 		
! 				updateString += privilegesWithGrant[i];
! 			
! 				if (i < privilegesWithGrant.length - 1)
! 					updateString += ", ";
! 					
! 			}
! 		
! 			updateString += " ON TABLE " + viewList + " TO " + userList + " WITH GRANT OPTION; ";
! 			
! 		}
! 		
! 		return updateString;
  	}
  
  
***************
*** 469,475 ****
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_SEQUENCES, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_SEQUENCE_PRIVILEGES};
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String sequenceList = "";
--- 529,535 ----
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_SEQUENCES, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_SEQUENCE_PRIVILEGES, PARAM_SEQUENCE_PRIVILEGES_WITH_GRANT };
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String sequenceList = "";
***************
*** 555,561 ****
  			
  		}
  
! 		return updateString;		
  	}
  
  	
--- 615,641 ----
  			
  		}
  
! 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_SEQUENCE_PRIVILEGES_WITH_GRANT)).values().toArray();
! 		
! 		if (privilegesWithGrant.length != 0) {
! 		
! 			// Add grant call
! 			updateString += "GRANT ";
! 		
! 			for (int i = 0; i < privilegesWithGrant.length; i++) {
! 		
! 				updateString += privilegesWithGrant[i];
! 			
! 				if (i < privilegesWithGrant.length - 1)
! 					updateString += ", ";
! 					
! 			}
! 		
! 			updateString += " ON TABLE " + sequenceList + " TO " + userList + " WITH GRANT OPTION; ";
! 			
! 		}
! 		
! 		return updateString;
  	}
  
  	
***************
*** 573,579 ****
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_DATABASES, PARAM_USERS, PARAM_GROUPS, PARAM_DATABASE_PRIVILEGES};
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String databaseList = "";
--- 653,659 ----
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_DATABASES, PARAM_USERS, PARAM_GROUPS, PARAM_DATABASE_PRIVILEGES, PARAM_DATABASE_PRIVILEGES_WITH_GRANT };
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String databaseList = "";
***************
*** 658,663 ****
--- 738,762 ----
  			
  		}
  		
+ 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_DATABASE_PRIVILEGES_WITH_GRANT)).values().toArray();
+ 
+ 		if (privilegesWithGrant.length != 0) {
+ 		
+ 			// Add grant call
+ 			updateString += "GRANT ";
+ 		
+ 			for (int i = 0; i < privilegesWithGrant.length; i++) {
+ 		
+ 				updateString += privilegesWithGrant[i];
+ 			
+ 				if (i < privilegesWithGrant.length - 1)
+ 					updateString += ", ";
+ 					
+ 			}
+ 		
+ 			updateString += " ON DATABASE " + databaseList + " TO " + userList + " WITH GRANT OPTION; ";
+ 		}
+ 
  		return updateString;	
  	}
  	
***************
*** 675,681 ****
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_SCHEMAS, PARAM_USERS, PARAM_GROUPS, PARAM_SCHEMA_PRIVILEGES};
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String schemaList = "";
--- 774,780 ----
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_SCHEMAS, PARAM_USERS, PARAM_GROUPS, PARAM_SCHEMA_PRIVILEGES, PARAM_SCHEMA_PRIVILEGES_WITH_GRANT };
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String schemaList = "";
***************
*** 760,765 ****
--- 859,884 ----
  			
  		}
  		
+ 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_SCHEMA_PRIVILEGES_WITH_GRANT)).values().toArray();
+ 		
+ 		if (privilegesWithGrant.length != 0) {
+ 		
+ 			// Add grant call
+ 			updateString += "GRANT ";
+ 		
+ 			for (int i = 0; i < privilegesWithGrant.length; i++) {
+ 		
+ 				updateString += privilegesWithGrant[i];
+ 			
+ 				if (i < privilegesWithGrant.length - 1)
+ 					updateString += ", ";
+ 					
+ 			}
+ 		
+ 			updateString += " ON SCHEMA " + schemaList + " TO " + userList + " WITH GRANT OPTION; ";
+ 			
+ 		}
+ 		
  		return updateString;		
  	}
  	
***************
*** 777,783 ****
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_TABLES, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_TABLE_PRIVILEGES};
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String tableList = "";
--- 896,902 ----
  		// that the dialog always gives the non-optional parameters before its 
  		// too late.
  
! 		String[] requiredParameters = {PARAM_CLUSTER_NAME, PARAM_DB_NAME, PARAM_TABLES, PARAM_SCHEMA_NAME, PARAM_USERS, PARAM_GROUPS, PARAM_TABLE_PRIVILEGES, PARAM_TABLE_PRIVILEGES_WITH_GRANT };
  		String[] optionalParameters = {PARAM_PUBLIC};
  		String updateString = "";
  		String tableList = "";
***************
*** 863,868 ****
--- 982,1007 ----
  			
  		}
  		
+ 		Object[] privilegesWithGrant = ((Hashtable) parameters.get(PARAM_TABLE_PRIVILEGES_WITH_GRANT)).values().toArray();
+ 		
+ 		if (privilegesWithGrant.length != 0) {
+ 		
+ 			// Add grant call
+ 			updateString += "GRANT ";
+ 		
+ 			for (int i = 0; i < privilegesWithGrant.length; i++) {
+ 		
+ 				updateString += privilegesWithGrant[i];
+ 			
+ 				if (i < privilegesWithGrant.length - 1)
+ 					updateString += ", ";
+ 					
+ 			}
+ 		
+ 			updateString += " ON TABLE " + tableList + " TO " + userList + " WITH GRANT OPTION; ";
+ 			
+ 		}
+ 		
  		return updateString;		
  	}
  }
Index: src/com/redhat/rhdb/admin/pgsql/AbstractRhdb73DatabaseMetaData.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/pgsql/AbstractRhdb73DatabaseMetaData.java,v
retrieving revision 1.2
diff -c -r1.2 AbstractRhdb73DatabaseMetaData.java
*** src/com/redhat/rhdb/admin/pgsql/AbstractRhdb73DatabaseMetaData.java	4 May 2004 16:57:15 -0000	1.2
--- src/com/redhat/rhdb/admin/pgsql/AbstractRhdb73DatabaseMetaData.java	9 Jun 2004 05:39:28 -0000
***************
*** 15,21 ****
  import java.sql.*;
  import java.util.*;
  import org.postgresql.jdbc3.*;
! import org.postgresql.Field;
  
  import com.redhat.rhdb.admin.utils.AdminNamedObject;
  
--- 15,21 ----
  import java.sql.*;
  import java.util.*;
  import org.postgresql.jdbc3.*;
! import org.postgresql.core.*;
  
  import com.redhat.rhdb.admin.utils.AdminNamedObject;
  
***************
*** 982,996 ****
  	public ResultSet getDatabasePrivileges(String dbName) throws SQLException {
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
- 		sql = "SELECT d.datacl from pg_database d WHERE datname='" + escapeQuotes(dbName) + "' ";
- 	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
  		while (rs.next()) {
--- 982,999 ----
  	public ResultSet getDatabasePrivileges(String dbName) throws SQLException {
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
+ 
+ 		sql =	"SELECT d.datacl, u.usename from pg_database d, pg_user u " +
+ 				" WHERE datname='" + escapeQuotes(dbName) + "' AND u.usesysid=d.datdba";
  
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
  		while (rs.next()) {
***************
*** 999,1005 ****
  			//get the values of array 
  			
  			String acl = rs.getString(1);
! 			
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
  						
--- 1002,1009 ----
  			//get the values of array 
  			
  			String acl = rs.getString(1);
! 			String owner = rs.getString(2);
! 
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
  						
***************
*** 1019,1040 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
- 				
  		}
! 			
! 		return connection.getResultSet(null, f, v, "OK", 1);	
  	}
  
  	/**
--- 1023,1055 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					grantor = grantor.equals("") ? owner : grantor;
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  		}
! 
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
  	}
  
  	/**
***************
*** 1464,1477 ****
  		
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT proacl from pg_proc WHERE oid=" + OID;
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
--- 1479,1494 ----
  		
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT p.proacl, u.usename from pg_proc p, pg_user u WHERE p.oid=" + OID + " AND p.proowner=u.usesysid";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
***************
*** 1481,1486 ****
--- 1498,1504 ----
  			//get the values of array 
  			
  			String acl = rs.getString(1);
+ 			String owner = rs.getString(2);
  			
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
***************
*** 1501,1523 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
  				
  		}
! 			
! 		return connection.getResultSet(null, f, v, "OK", 1);
! 				
  	}
  
  
--- 1519,1552 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					grantor = grantor.equals("") ? owner : grantor;
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  				
  		}
! 
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
  	}
  
  
***************
*** 1535,1553 ****
  		
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
! 
! 		sql = 	" SELECT p.proacl  " +
! 			" FROM pg_proc p, pg_namespace n " +
  			" WHERE n.nspname='" + escapeQuotes(schemaName) + "' AND " +
  			"  	p.pronamespace=n.oid AND " +
! 			"	p.proname = '" + escapeQuotes(functionName) + "' ";
  
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
--- 1564,1584 ----
  		
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
  
! 		sql = 	" SELECT p.proacl, u.usename  " +
! 			" FROM pg_proc p, pg_namespace n, pg_user u " +
  			" WHERE n.nspname='" + escapeQuotes(schemaName) + "' AND " +
  			"  	p.pronamespace=n.oid AND " +
! 			"	p.proname = '" + escapeQuotes(functionName) + "' AND" +
! 			"   p.proowner=u.usesysid";
  
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
***************
*** 1557,1562 ****
--- 1588,1594 ----
  			//get the values of array 
  			
  			String acl = rs.getString(1);
+ 			String owner = rs.getString(2);
  			
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
***************
*** 1577,1599 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
  				
  		}
! 			
! 		return connection.getResultSet(null, f, v, "OK", 1);
! 				
  	}
  
  	/**
--- 1609,1642 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					grantor = grantor.equals("") ? owner : grantor;
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  				
  		}
! 
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);				
  	}
  
  	/**
***************
*** 1631,1636 ****
--- 1674,1690 ----
  	}
  
  	/**
+ 	 * Returns the grant option string for this database version. For 7.3 and 
+ 	 * lower, thee string is just ""
+ 	 *
+ 	 * @return The string
+ 	 */
+ 	
+ 	public String getGrantOptionString() {
+ 		return "";
+ 	}
+ 	
+ 	 /**
  	 * Returns info for a group.
  	 *
  	 * @param groupName Name of the group for which info is needed.
***************
*** 2044,2055 ****
  		
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
  		sql = "SELECT l.lanacl from pg_language l WHERE lanname='" + escapeQuotes(name) + "' ";
  	
--- 2098,2111 ----
  		
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
  
  		sql = "SELECT l.lanacl from pg_language l WHERE lanname='" + escapeQuotes(name) + "' ";
  	
***************
*** 2081,2102 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return connection.getResultSet(null, f, v, "OK", 1);				
  	}
  	
  	/**
--- 2137,2169 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = isPrivGrantable ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);	
  	}
  	
  	/**
***************
*** 2674,2687 ****
  	public ResultSet getSchemaPrivileges(String schemaName) throws SQLException {
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT n.nspacl from pg_namespace n WHERE nspname='" + escapeQuotes(schemaName) + "' ";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
--- 2741,2758 ----
  	public ResultSet getSchemaPrivileges(String schemaName) throws SQLException {
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
  
! 		sql =	"SELECT n.nspacl, u.usename from pg_namespace n, pg_user u " + 
! 				"   WHERE nspname='" + escapeQuotes(schemaName) + "' AND " + 
! 				"   u.usesysid=n.nspowner";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
***************
*** 2691,2696 ****
--- 2762,2768 ----
  			//get the values of array 
  			
  			String acl = rs.getString(1);
+ 			String owner = rs.getString(2);
  			
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
***************
*** 2711,2732 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return connection.getResultSet(null, f, v, "OK", 1);	
  	}
  
  	/**
--- 2783,2816 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					grantor = grantor.equals("") ? owner : grantor;
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
  	}
  
  	/**
***************
*** 2824,2840 ****
  		
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT c.relacl from pg_class c, pg_namespace n " +
  			"WHERE c.relname='" + escapeQuotes(sequenceName) + "' " +
  			"AND c.relnamespace = n.oid " +
! 			"AND n.nspname='" + escapeQuotes(schemaName) + "' ";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
--- 2908,2927 ----
  		
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT c.relacl, u.usename from pg_class c, pg_namespace n, pg_user u " +
  			"WHERE c.relname='" + escapeQuotes(sequenceName) + "' " +
  			"AND c.relnamespace = n.oid " +
! 			"AND n.nspname='" + escapeQuotes(schemaName) + "' " +
! 			"AND u.usesysid=c.relowner";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
***************
*** 2844,2849 ****
--- 2931,2937 ----
  			//get the values of array 
  			
  			String acl = rs.getString(1);
+ 			String owner = rs.getString(2);
  			
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
***************
*** 2864,2886 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return connection.getResultSet(null, f, v, "OK", 1);
! 				
  	}
  	
  	/**
--- 2952,2985 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					grantor = grantor.equals("") ? owner : grantor;
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);				
  	}
  	
  	/**
***************
*** 3072,3077 ****
--- 3171,3289 ----
  		return connection.createStatement().executeQuery(sql);
  	}
  
+ 	/*
+ 	* Get a description of the access rights for each table available
+ 	* in a catalog.
+ 	*
+ 	* This method is currently unimplemented.
+ 	*
+ 	* <P>Only privileges matching the schema and table name
+ 	* criteria are returned.  They are ordered by TABLE_SCHEM,
+ 	* TABLE_NAME, and PRIVILEGE.
+ 	*
+ 	* <P>Each privilige description has the following columns:
+ 	*	<OL>
+ 	*	<LI><B>TABLE_CAT</B> String => table catalog (may be null)
+ 	*	<LI><B>TABLE_SCHEM</B> String => table schema (may be null)
+ 	*	<LI><B>TABLE_NAME</B> String => table name
+ 	*	<LI><B>GRANTOR</B> => grantor of access (may be null)
+ 	*	<LI><B>GRANTEE</B> String => grantee of access
+ 	*	<LI><B>PRIVILEGE</B> String => name of access (SELECT,
+ 	*		INSERT, UPDATE, REFRENCES, ...)
+ 	*	<LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
+ 	*		to grant to others; "NO" if not; null if unknown
+ 	*	</OL>
+ 	*
+ 	* @param catalog a catalog name; "" retrieves those without a catalog
+ 	* @param schemaPattern a schema name pattern; "" retrieves those
+ 	* without a schema
+ 	* @param tableNamePattern a table name pattern
+ 	* @return ResultSet each row is a table privilege description
+ 	* @see #getSearchStringEscape
+ 	*/
+ 	public java.sql.ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
+ 	{
+ 		Field f[] = new Field[7];
+ 		Vector v = new Vector();
+ 
+ 		f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, getMaxNameLength());
+ 		f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[4] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
+ 		f[5] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[6] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
+ 
+ 		String sql;
+ 		if (connection.haveMinimumServerVersion("7.3")) {
+ 			sql = "SELECT n.nspname,c.relname,u.usename,c.relacl "+
+ 				" FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u "+
+ 				" WHERE c.relnamespace = n.oid "+
+ 				" AND u.usesysid = c.relowner "+
+ 				" AND c.relkind = 'r' ";
+ 			if (schemaPattern != null && !"".equals(schemaPattern)) {
+ 				sql += " AND n.nspname LIKE '"+escapeQuotes(schemaPattern)+"' ";
+ 			}
+ 		} else {
+ 			sql = "SELECT NULL::text AS nspname,c.relname,u.usename,c.relacl "+
+ 				"FROM pg_class c, pg_user u "+
+ 				" WHERE u.usesysid = c.relowner "+
+ 				" AND c.relkind = 'r' ";
+ 		}
+ 
+ 		if (tableNamePattern != null && !"".equals(tableNamePattern)) {
+ 			sql += " AND c.relname LIKE '"+escapeQuotes(tableNamePattern)+"' ";
+ 		}
+ 		sql += " ORDER BY nspname, relname ";
+ 
+ 		ResultSet rs = connection.createStatement().executeQuery(sql);
+ 		while (rs.next()) {
+ 			byte schema[] = rs.getBytes("nspname");
+ 			byte table[] = rs.getBytes("relname");
+ 			String owner = rs.getString("usename");
+ 			String acl = rs.getString("relacl");
+ 			Hashtable permissions = parseACL(acl, owner);
+ 			String permNames[] = new String[permissions.size()];
+ 			Enumeration e = permissions.keys();
+ 			int i=0;
+ 			while (e.hasMoreElements()) {
+ 				permNames[i++] = (String)e.nextElement();
+ 			}
+ 			Arrays.sort(permNames);
+ 			for (i=0; i<permNames.length; i++) {
+ 				byte[] privilege = encoding.encode(permNames[i]);
+ 				Vector grantees = (Vector)permissions.get(permNames[i]);
+ 				for (int j=0; j<grantees.size(); j++) {
+ 					String grantee = (String)((String[])grantees.elementAt(j))[0];
+ 					String grantor = (String)((String[])grantees.elementAt(j))[1];
+ 					grantor = grantor.equals("") ? owner : grantor;
+ 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
+ 
+ 					// see below for grantee == grantor case
+ 
+ 					// The handling of this slightly differs due to differences 
+ 					// in 7.3.x and 7.4+ backends
+ 
+ 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
+ 
+ 					byte[][] tuple = new byte[7][];
+ 					tuple[0] = null;
+ 					tuple[1] = schema;
+ 					tuple[2] = table;
+ 					tuple[3] = encoding.encode(grantor);
+ 					tuple[4] = encoding.encode(grantee);
+ 					tuple[5] = privilege;
+ 					tuple[6] = encoding.encode(grantable);
+ 					v.addElement(tuple);
+ 				}
+ 			}
+ 		}
+ 
+ 		rs.close();
+ 
+ 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
+ 	}
+ 	
  	/**
  	 * Returns the summary info for tables
  	 *
***************
*** 3929,3935 ****
  	 */
  	
  	public String[] getValidSequencePrivileges() {
! 		return new String[] {"SELECT", "UPDATE", "INSERT", "DELETE", "RULE", "REFERENCES", "TRIGGER"};
  	}
  	
  	/**
--- 4141,4147 ----
  	 */
  	
  	public String[] getValidSequencePrivileges() {
! 		return new String[] {"DELETE", "INSERT", "REFERENCES", "RULE", "SELECT", "TRIGGER", "UPDATE" };
  	}
  	
  	/**
***************
*** 3939,3945 ****
  	 */
  	
  	public String[] getValidTablePrivileges() {
! 		return new String[] {"SELECT", "UPDATE", "INSERT", "DELETE", "RULE", "REFERENCES", "TRIGGER"};
  	}
  	
  	/**
--- 4151,4157 ----
  	 */
  	
  	public String[] getValidTablePrivileges() {
! 		return new String[] {"DELETE", "INSERT", "REFERENCES", "RULE", "SELECT", "TRIGGER", "UPDATE" };
  	}
  	
  	/**
***************
*** 3949,3955 ****
  	 */
  	
  	public String[] getValidViewPrivileges() {
! 		return new String[] {"SELECT", "UPDATE", "INSERT", "DELETE", "RULE", "REFERENCES", "TRIGGER"};
  	}
  	
  	/**
--- 4161,4167 ----
  	 */
  	
  	public String[] getValidViewPrivileges() {
! 		return new String[] {"DELETE", "INSERT", "REFERENCES", "RULE", "SELECT", "TRIGGER", "UPDATE" };
  	}
  	
  	/**
***************
*** 4112,4128 ****
  		
  		String sql;
  			
! 		Field f[] = new Field[2];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT c.relacl from pg_class c, pg_namespace n " +
  			"WHERE c.relname='" + escapeQuotes(name) + "' " +
  			"AND c.relnamespace = n.oid " +
! 			"AND n.nspname='" + escapeQuotes(schemaName) + "' ";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
--- 4324,4343 ----
  		
  		String sql;
  			
! 		Field f[] = new Field[4];
  		Vector v = new Vector();
  
  			
  		f[0] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
  		f[1] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
+ 		f[2] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
+ 		f[3] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
  
! 		sql = "SELECT c.relacl, u.usename from pg_class c, pg_namespace n, pg_user u " +
  			"WHERE c.relname='" + escapeQuotes(name) + "' " +
  			"AND c.relnamespace = n.oid " +
! 			"AND n.nspname='" + escapeQuotes(schemaName) + "' " +
! 			"AND u.usesysid=c.relowner";
  	
  		ResultSet rs = connection.createStatement().executeQuery(sql);
  		
***************
*** 4132,4137 ****
--- 4347,4353 ----
  			//get the values of array 
  			
  			String acl = rs.getString(1);
+ 			String owner = rs.getString(2);
  			
  			//parse acl array and put its values into a hashtable that has 
  			//keys as the privileges names and values are the grantee of the privileges
***************
*** 4152,4174 ****
  				i++;
  			}
  			
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)grantees.elementAt(j);
! 					byte[][] tuple = new byte[2][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return connection.getResultSet(null, f, v, "OK", 1);
! 				
  	}
  	
  	/**
--- 4368,4401 ----
  				i++;
  			}
  			
+ 			Arrays.sort(permNames);
  			//for every permission get the user or group name
  			for (i=0; i<permNames.length; i++) {
  				byte[] privilege = permNames[i].getBytes();
  				Vector grantees = (Vector)permissions.get(permNames[i]);
  				for (int j=0; j<grantees.size(); j++) {
! 					String grantee = (String)((String[])grantees.elementAt(j))[0];
! 					String grantor = (String)((String[])grantees.elementAt(j))[1];
! 					grantor = grantor.equals("") ? owner : grantor;
! 					boolean isPrivGrantable = ((String[])grantees.elementAt(j))[2].equals("t");
! 
! 					// The handling of this slightly differs due to differences 
! 					// in 7.3.x and 7.4+ backends
! 
! 					String grantable = (isPrivGrantable || owner.equals(grantee)) ? "YES" : "NO";
! 
! 					byte[][] tuple = new byte[4][];
  					tuple[0] = grantee.getBytes();
  					tuple[1] = privilege;
+ 					tuple[2] = grantor.getBytes();
+ 					tuple[3] = grantable.getBytes();
  					v.addElement(tuple);
  				}
  			}
  				
  		}
  			
! 		return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);				
  	}
  	
  	/**
***************
*** 4265,4273 ****
  		
  		return rs.getObject(1).equals("on");
  	}
! 											    			        	
! }
  
  
  
  
--- 4492,4726 ----
  		
  		return rs.getObject(1).equals("on");
  	}
! 	
! 	/******* Helper functions *******/
! 	
! 	/**
! 	 * Break down the ACL string into it's components.
! 	 *
! 	 * @param aclString The ACL String to breakdown.
! 	 * @return A <code>String</code> array containing the components of the ACL string.
! 	 */
! 	
! 	private static String[] getACLComponents(String aclString) {
! 		
! 		
! 		if (aclString.startsWith("\"") && aclString.endsWith("\"")) {
! 			aclString = aclString.substring(1,aclString.length()-1);
! 		}
! 		
! 		boolean permissionsProcessed = false;
! 		boolean passedEqualSign = false;
! 		String[] aclComponents = {"", "", ""};
! 		
! 		boolean inQuotes = false;
! 		// start at 1 because of leading "{"
! 		int beginIndex = 0;
! 		char prevChar = ' ';
! 		
! 		for (int i=beginIndex; i<aclString.length(); i++) {
! 			
! 			char c = aclString.charAt(i);
! 			
! 			// We are in quotes if this char is a double quote and the
! 			// previous IS an escape
! 			
! 			if (c == '"' && prevChar == '\\') {
! 				inQuotes = !inQuotes;
! 			} else if (c == '=' && !inQuotes) {
! 				
! 				// '=' and not in quotes => GRANTOR ends here
! 				
! 				aclComponents[0]=aclString.substring(beginIndex, i);
! 				
! 				beginIndex = i+1;
! 				
! 				passedEqualSign = true;
! 				
! 			} else if (c == '/' && !inQuotes && passedEqualSign) {
! 				
! 				// '/' and not in quotes AND equal sign passed =>
! 				// permissions end here.
! 				
! 				// We need a check for equal sign passed because in 7.3
! 				// and lower, user names with "=" are in quotes, but
! 				// user names with "/" aren't, which will cause a check
! 				// without 'passedEqualSign' to go through, even though it
! 				// is wrong!
! 				
! 				aclComponents[1]=aclString.substring(beginIndex, i);
! 				
! 				beginIndex = i+1;
! 				
! 				permissionsProcessed = true;
! 				
! 			} else if (i == aclString.length()-1) {
! 				
! 				// If permissions have already been encountered, this is
! 				// the grantor (7.4+).. else it's permissions (7.3-)
! 				
! 				if (permissionsProcessed) {
! 					aclComponents[2]=aclString.substring(beginIndex);
! 				} else {
! 					aclComponents[1]=aclString.substring(beginIndex);
! 					
! 					// GRANTOR unknown.. most likely means owner is
! 					// grantor.. but let caller make that decision
! 					
! 					aclComponents[2] = "";
! 				}
! 				
! 			}
! 			
! 			prevChar = c;
! 		}
! 		
! 		return aclComponents;
! 		
! 	}
! 	
! 	/**
! 	 * Parse an String of ACLs into a Vector of ACLs.
! 	 */
! 	private static Vector parseACLArray(String aclString) {
! 		Vector acls = new Vector();
! 		if (aclString == null || aclString.length() == 0) {
! 			return acls;
! 		}
! 		boolean inQuotes = false;
! 		// start at 1 because of leading "{"
! 		int beginIndex = 1;
! 		char prevChar = ' ';
! 		for (int i=beginIndex; i<aclString.length(); i++) {
! 			
! 			char c = aclString.charAt(i);
! 			if (c == '"' && prevChar != '\\') {
! 				inQuotes = !inQuotes;
! 			} else if (c == ',' && !inQuotes) {
! 				acls.addElement(aclString.substring(beginIndex,i));
! 				beginIndex = i+1;
! 			}
! 			prevChar = c;
! 		}
! 		// add last element removing the trailing "}"
! 		acls.addElement(aclString.substring(beginIndex,aclString.length()-1));
! 		
! 		// Strip out enclosing quotes, if any.
! 		for (int i=0; i<acls.size(); i++) {
! 			String acl = (String)acls.elementAt(i);
! 			if (acl.startsWith("\"") && acl.endsWith("\"")) {
! 				acl = acl.substring(1,acl.length()-1);
! 				acls.setElementAt(acl,i);
! 			}
! 		}
! 		return acls;
! 	}
! 	
! 	/**
! 	 * Add the user described by the given acl to the Vectors of users
! 	 * with the privileges described by the acl.
! 	 */
! 	
! 	private static void addACLPrivileges(boolean haveMin74, String acl, Hashtable privileges) {
! 		
! 		String name, privs, grantor;
! 		
! 		if (haveMin74) {
! 			String[] aclComp = getACLComponents(acl);
! 			name = aclComp[0];
! 			privs = aclComp[1];
! 			grantor = aclComp[2];
! 		} else {
! 			int equalIndex = acl.lastIndexOf("=");
! 			name = acl.substring(0,equalIndex);
! 			privs = acl.substring(equalIndex+1);
! 			grantor = "";
! 		}
! 
! 		// name == grantor is skipped, because in such cases, we are refering 
! 		// to owner, who always has ALL privileges. This return here seems 
! 		// unnecessary, but it infact required due to a bug in (atleast upto) 
! 		// 7.4.2 which allows a privilege to be revoked from an owner, but not 
! 		// its grantable property. So we could end up with an ACL like 
! 		// "a**w*..". Until the problem is fixed, we give owner ALL privileges,
! 		// whether or not the ACL says so. This is required anyways since 
! 		// according to the JDBC standard, return format for getTablePrvileges()
! 		// provides no way to specify GRANTOR permission for some permission 
! 		// "X", but not the permission "X" itself.
! 
! 		//if (name.equals(grantor))
! 		//	return;
! 
! 		if (name.length() == 0) {
! 			name = "PUBLIC";
! 		}
! 		
! 		for (int i=0; i<privs.length(); i++) {
! 			String hasGrantorPriv = "f";
! 			char c = privs.charAt(i);
! 			char next = ' ';
! 			if (i<(privs.length() - 1)) {
! 				next = privs.charAt(i+1);
! 			}
! 			String sqlpriv;
! 			switch (c) {
! 				case 'a': sqlpriv = "INSERT"; break;
! 				case 'r': sqlpriv = "SELECT"; break;
! 				case 'w': sqlpriv = "UPDATE"; break;
! 				case 'd': sqlpriv = "DELETE"; break;
! 				case 'R': sqlpriv = "RULE"; break;
! 				case 'x': sqlpriv = "REFERENCES"; break;
! 				case 't': sqlpriv = "TRIGGER"; break;
! 				// the following can't be granted to a table, but
! 				// we'll keep them for completeness.
! 				case 'X': sqlpriv = "EXECUTE"; break;
! 				case 'U': sqlpriv = "USAGE"; break;
! 				case 'C': sqlpriv = "CREATE"; break;
! 				case 'T': sqlpriv = "CREATE TEMP"; break;
! 				case '*': if (name.equals(grantor)) continue;
! 				default: sqlpriv = "UNKNOWN";
! 			}
! 
! 			/* Need to handle case where we can have owner with
! 			 * GRANTOR privilege, but not the privilege itself.. this
! 			 * seems like a bug in the backend */
! 			
! 			if (next == '*') {
! 				hasGrantorPriv = "t";
! 				i++;
! 			}
! 
! 			Vector usersWithPermission = (Vector)privileges.get(sqlpriv);
! 			if (usersWithPermission == null) {
! 				usersWithPermission = new Vector();
! 				privileges.put(sqlpriv,usersWithPermission);
! 			}
  
+ 			String[] grantee_grantor = {name, grantor, hasGrantorPriv};
+ 			usersWithPermission.addElement(grantee_grantor);
+ 		}
+ 	}
+ 	
+ 	/**
+ 	 * Take the a String representing an array of ACLs and return
+ 	 * a Hashtable mapping the SQL permission name to a Vector of
+ 	 * usernames who have that permission.
+ 	 */
+ 	protected Hashtable parseACL(String aclArray, String owner) throws SQLException {
+ 		if (aclArray == null || aclArray == "") {
+ 			//null acl is a shortcut for owner having full privs
+ 			aclArray = "{" + owner + "=arwdRxt}";
+ 		}
+ 		Vector acls = parseACLArray(aclArray);
+ 		Hashtable privileges = new Hashtable();
+ 		boolean haveMin74 = connection.haveMinimumServerVersion("7.4");
+ 		for (int i=0; i<acls.size(); i++) {
+ 			String acl = (String)acls.elementAt(i);
+ 			addACLPrivileges(haveMin74, acl,privileges);
+ 		}
+ 		return privileges;
+ 	}
+ }
  
  
  
Index: src/com/redhat/rhdb/admin/pgsql/AbstractRhdb74DatabaseMetaData.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/pgsql/AbstractRhdb74DatabaseMetaData.java,v
retrieving revision 1.2
diff -c -r1.2 AbstractRhdb74DatabaseMetaData.java
*** src/com/redhat/rhdb/admin/pgsql/AbstractRhdb74DatabaseMetaData.java	4 May 2004 16:57:15 -0000	1.2
--- src/com/redhat/rhdb/admin/pgsql/AbstractRhdb74DatabaseMetaData.java	9 Jun 2004 05:39:28 -0000
***************
*** 51,55 ****
--- 51,66 ----
  		
  		return connection.createStatement().executeQuery(sql);
  	}
+ 	
+ 	/**
+ 	 * Returns the grant option string for this database version. For 7.4 and 
+ 	 * higher, thee string is "WITH GRANT OPTION"
+ 	 *
+ 	 * @return The string
+ 	 */
+ 	
+ 	public String getGrantOptionString() {
+ 		return "WITH GRANT OPTION";
+ 	}
  }
  
Index: src/com/redhat/rhdb/admin/pgsql/AdminDatabaseMetaData.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/pgsql/AdminDatabaseMetaData.java,v
retrieving revision 1.2
diff -c -r1.2 AdminDatabaseMetaData.java
*** src/com/redhat/rhdb/admin/pgsql/AdminDatabaseMetaData.java	4 May 2004 16:57:15 -0000	1.2
--- src/com/redhat/rhdb/admin/pgsql/AdminDatabaseMetaData.java	9 Jun 2004 05:39:28 -0000
***************
*** 116,121 ****
--- 116,123 ----
  	
  	ResultSet getFunctionWithNoArguments(String name) throws SQLException;
  
+ 	String getGrantOptionString();
+ 	
  	ResultSet getGroups() throws SQLException;
  	
  	ResultSet getGroupInfo(String groupName) throws SQLException;
Index: src/com/redhat/rhdb/admin/tree/DatabaseNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/DatabaseNode.java,v
retrieving revision 1.2
diff -c -r1.2 DatabaseNode.java
*** src/com/redhat/rhdb/admin/tree/DatabaseNode.java	23 Dec 2003 16:50:04 -0000	1.2
--- src/com/redhat/rhdb/admin/tree/DatabaseNode.java	9 Jun 2004 05:39:29 -0000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 378,383 ****
--- 378,384 ----
  					
  					toShow = "";
  					String userName = privData[j][0];
+ 					String grantor = privData[j][2];
  					toShow += userName;
  					toShow += "(";
  					
***************
*** 386,391 ****
--- 387,396 ----
  					else 
  						toShow += privData[j][1];
  					
+ 					if (privData[j][3].equals("YES")) {
+ 						toShow += "*";
+ 					}
+ 					
  					for (int k=j+1; k < privData.length; k++) {
  						if (privData[k][0] != null && privData[k][0].equals(userName)) {
  							
***************
*** 394,404 ****
  							else 
  								toShow += " " + privData[k][1];
  								
  							privData[k][0] = null;
  						}
  					}
  					
! 					toShow += ")";
  					entries.add(toShow);
  				}
  				
--- 399,413 ----
  							else 
  								toShow += " " + privData[k][1];
  								
+ 							if (privData[k][3].equals("YES")) {
+ 								toShow += "*";
+ 							}
+ 
  							privData[k][0] = null;
  						}
  					}
  					
! 					toShow += ")/" + grantor;
  					entries.add(toShow);
  				}
  				
Index: src/com/redhat/rhdb/admin/tree/FunctionNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/FunctionNode.java,v
retrieving revision 1.3
diff -c -r1.3 FunctionNode.java
*** src/com/redhat/rhdb/admin/tree/FunctionNode.java	31 Dec 2003 05:56:38 -0000	1.3
--- src/com/redhat/rhdb/admin/tree/FunctionNode.java	9 Jun 2004 05:39:29 -0000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 466,473 ****
  							privData[j][0].substring(privData[j][0].indexOf(' ')) + " (" + 
  							privData[j][1] + ")";
  					else
! 						toShow = privData[j][0] + " (" + privData[j][1] + ")";
! 															
  					entries.add(toShow);
  				}
  				
--- 466,479 ----
  							privData[j][0].substring(privData[j][0].indexOf(' ')) + " (" + 
  							privData[j][1] + ")";
  					else
! 						toShow = privData[j][0] + " (" + privData[j][1];
! 					
! 					if (privData[j][3].equals("YES")) {
! 								toShow += "*";
! 					}
! 					
! 					toShow += ")/" + privData[j][2];
! 					
  					entries.add(toShow);
  				}
  				
Index: src/com/redhat/rhdb/admin/tree/LanguageNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/LanguageNode.java,v
retrieving revision 1.3
diff -c -r1.3 LanguageNode.java
*** src/com/redhat/rhdb/admin/tree/LanguageNode.java	3 Jan 2004 04:30:18 -0000	1.3
--- src/com/redhat/rhdb/admin/tree/LanguageNode.java	9 Jun 2004 05:39:29 -0000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 426,432 ****
  								+ AdminResources.getString(AdminResources.VIEW_GROUP_PRIV_PREFIX) + privelegesData[j][0].substring(index+5);							
  						}	
  	
! 						entries.add(privelegesData[j][0]+ "  (" + privelegesData[j][1] + ") ");
  					}
  						
  					Object[] entryArray = entries.toArray();
--- 426,444 ----
  								+ AdminResources.getString(AdminResources.VIEW_GROUP_PRIV_PREFIX) + privelegesData[j][0].substring(index+5);							
  						}	
  	
! 						String toShow = privelegesData[j][0]+ "  (" + privelegesData[j][1];
! 						
! 						if (privelegesData[j][3].equals("YES")) {
! 							toShow += "*";
! 						}
! 						
! 						toShow += ")";
! 						
! 						if (!privelegesData[j][2].equals("")) {
! 							toShow += "/" + privelegesData[j][2];
! 						}
! 						
! 						entries.add(toShow);
  					}
  						
  					Object[] entryArray = entries.toArray();
Index: src/com/redhat/rhdb/admin/tree/SchemaNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/SchemaNode.java,v
retrieving revision 1.2
diff -c -r1.2 SchemaNode.java
*** src/com/redhat/rhdb/admin/tree/SchemaNode.java	23 Dec 2003 16:50:04 -0000	1.2
--- src/com/redhat/rhdb/admin/tree/SchemaNode.java	9 Jun 2004 05:39:30 -0000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 237,242 ****
--- 237,243 ----
  			privData = client.resultSetToStringArray(dbmd.getSchemaPrivileges(this.toString()), lease);
  		} catch (Exception e) {
  			// ANY exception at this point is reason enough to abort
+ 			e.printStackTrace();
  			throw new ViewRaiseException(this, e);
  		}
  		
***************
*** 337,354 ****
  					
  					toShow = "";
  					String userName = privData[j][0];
  					toShow += userName;
  					toShow += "(";
  					toShow += privData[j][1];
  
  					for (int k=j+1; k < privData.length; k++) {
  						if (privData[k][0] != null && privData[k][0].equals(userName)) {
  							toShow += " " + privData[k][1];
  							privData[k][0] = null;
  						}
  					}
  					
! 					toShow += ")";
  					entries.add(toShow);
  				}
  				
--- 338,362 ----
  					
  					toShow = "";
  					String userName = privData[j][0];
+ 					String grantor = privData[j][2];
  					toShow += userName;
  					toShow += "(";
  					toShow += privData[j][1];
+ 					if (privData[j][3].equals("YES"))
+ 								toShow += "*";
  
  					for (int k=j+1; k < privData.length; k++) {
  						if (privData[k][0] != null && privData[k][0].equals(userName)) {
  							toShow += " " + privData[k][1];
+ 							
+ 							if (privData[k][3].equals("YES"))
+ 								toShow += "*";
+ 							
  							privData[k][0] = null;
  						}
  					}
  					
! 					toShow += ")/" + grantor;
  					entries.add(toShow);
  				}
  				
Index: src/com/redhat/rhdb/admin/tree/SequenceNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/SequenceNode.java,v
retrieving revision 1.3
diff -c -r1.3 SequenceNode.java
*** src/com/redhat/rhdb/admin/tree/SequenceNode.java	4 May 2004 16:57:16 -0000	1.3
--- src/com/redhat/rhdb/admin/tree/SequenceNode.java	9 Jun 2004 05:39:30 -0000
***************
*** 393,415 ****
  					// check if row has been added
  					if (privData[j][0] == null)
  						continue;
! 						
  					if (privData[j][0].startsWith("group "))
  						toShow = AdminResources.getString(AdminResources.VIEW_GROUP_PRIV_PREFIX) + 
  							privData[j][0].substring(privData[j][0].indexOf(' ')) + " (" + 
  							privData[j][1];
  					else
  						toShow = privData[j][0] + " (" + privData[j][1];
! 										
  					for (int k = j + 1; k < privData.length; k++) {
  						if ((privData[k][0] != null) && privData[k][0].equals(privData[j][0])) {
  							toShow += " " + privData[k][1];
  							// set each added row to null
  							privData[k][0] = null;
  						}
  					}
  					
! 					toShow += ")";
  					entries.add(toShow);
  				}
  				
--- 393,423 ----
  					// check if row has been added
  					if (privData[j][0] == null)
  						continue;
! 					
! 					String grantor = privData[j][2];
  					if (privData[j][0].startsWith("group "))
  						toShow = AdminResources.getString(AdminResources.VIEW_GROUP_PRIV_PREFIX) + 
  							privData[j][0].substring(privData[j][0].indexOf(' ')) + " (" + 
  							privData[j][1];
  					else
  						toShow = privData[j][0] + " (" + privData[j][1];
! 
! 					if (privData[j][3].equals("YES"))
! 								toShow += "*";
! 
  					for (int k = j + 1; k < privData.length; k++) {
  						if ((privData[k][0] != null) && privData[k][0].equals(privData[j][0])) {
  							toShow += " " + privData[k][1];
+ 							
+ 							if (privData[k][3].equals("YES"))
+ 								toShow += "*";
+ 
  							// set each added row to null
  							privData[k][0] = null;
  						}
  					}
  					
! 					toShow += ")/" + grantor;
  					entries.add(toShow);
  				}
  				
Index: src/com/redhat/rhdb/admin/tree/TableNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/TableNode.java,v
retrieving revision 1.3
diff -c -r1.3 TableNode.java
*** src/com/redhat/rhdb/admin/tree/TableNode.java	4 May 2004 16:57:16 -0000	1.3
--- src/com/redhat/rhdb/admin/tree/TableNode.java	9 Jun 2004 05:39:30 -0000
***************
*** 312,317 ****
--- 312,318 ----
  			metaData = client.resultSetToStringArray(dbmd.getTableInfo(this.getParentSchemaName(), this.toString()), lease);
  			privData = client.resultSetToStringArray(dbmd.getTablePrivileges(null, this.getParentSchemaName(), this.toString()), lease);
  		} catch (Exception e) {
+ 			e.printStackTrace();
  			// ANY exception at this point is reason enough to abort
  			throw new ViewRaiseException(this, e);
  		}
***************
*** 567,584 ****
  					
  					toShow = "";
  					String userName = privData[j][4];
  					toShow += userName;
  					toShow += "(";
  					toShow += privData[j][5];
  
  					for (int k=j+1; k < privData.length; k++) {
  						if (privData[k][4] != null && privData[k][4].equals(userName)) {
  							toShow += " " + privData[k][5];
  							privData[k][4] = null;
  						}
  					}
  					
! 					toShow += ")";
  					entries.add(toShow);
  				}
  				
--- 568,595 ----
  					
  					toShow = "";
  					String userName = privData[j][4];
+ 					String grantor = privData[j][3];
  					toShow += userName;
  					toShow += "(";
  					toShow += privData[j][5];
+ 					
+ 					if(privData[j][6].equals("YES")) {
+ 								toShow += "*";
+ 					}
  
  					for (int k=j+1; k < privData.length; k++) {
  						if (privData[k][4] != null && privData[k][4].equals(userName)) {
  							toShow += " " + privData[k][5];
+ 
+ 							if(privData[k][6].equals("YES")) {
+ 								toShow += "*";
+ 							}
+ 							
  							privData[k][4] = null;
  						}
  					}
  					
! 					toShow += ")/" + grantor;
  					entries.add(toShow);
  				}
  				
Index: src/com/redhat/rhdb/admin/tree/ViewNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/ViewNode.java,v
retrieving revision 1.2
diff -c -r1.2 ViewNode.java
*** src/com/redhat/rhdb/admin/tree/ViewNode.java	23 Dec 2003 16:50:04 -0000	1.2
--- src/com/redhat/rhdb/admin/tree/ViewNode.java	9 Jun 2004 05:39:31 -0000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
   * This software may be freely redistributed under the terms of the
   * GNU General Public License.
   *
***************
*** 577,583 ****
  							
  							// So, first extract the privileges list and add a new element.
  							ArrayList privilegesList = (ArrayList)privilegesMap.get(privilegesData[j][0]);
! 							privilegesList.add(privilegesData[j][1]);
  							
  							// Replace the entry in the map with the updated list.
  							privilegesMap.remove(privilegesData[j][0]);
--- 577,590 ----
  							
  							// So, first extract the privileges list and add a new element.
  							ArrayList privilegesList = (ArrayList)privilegesMap.get(privilegesData[j][0]);
! 							
! 							String priv = privilegesData[j][1];
! 							
! 							if (privilegesData[j][3].equals("YES")) {
! 								priv += "*";
! 							}
! 
! 							privilegesList.add(priv);
  							
  							// Replace the entry in the map with the updated list.
  							privilegesMap.remove(privilegesData[j][0]);
***************
*** 588,597 ****
  							// If the grantee is not in the map yet, add it now.
  							
  							ArrayList privilegesList = new ArrayList();
- 							privilegesList.add(privilegesData[j][1]);
  							
! 							privilegesMap.put(privilegesData[j][0], privilegesList);
  							
  						}
  					}
  					
--- 595,614 ----
  							// If the grantee is not in the map yet, add it now.
  							
  							ArrayList privilegesList = new ArrayList();
  							
! 							// First element is the GRANTOR
! 							
! 							privilegesList.add(privilegesData[j][2]);
  							
+ 							String priv = privilegesData[j][1];
+ 							
+ 							if (privilegesData[j][3].equals("YES")) {
+ 								priv += "*";
+ 							}
+ 							
+ 							privilegesList.add(priv);
+ 							
+ 							privilegesMap.put(privilegesData[j][0], privilegesList);
  						}
  					}
  					
***************
*** 607,619 ****
  						String[] privileges = new String[privilegesList.size()];
  						privilegesList.toArray(privileges);
  						
! 						for (int k = 0; k < privileges.length; k++) {
  							entry += privileges[k];
  							if (k < privileges.length - 1)
  								entry += " ";
  						}
  						
! 						entry += ")";
  						
  						columnEntry.put(entry, null);
  						
--- 624,636 ----
  						String[] privileges = new String[privilegesList.size()];
  						privilegesList.toArray(privileges);
  						
! 						for (int k = 1; k < privileges.length; k++) {
  							entry += privileges[k];
  							if (k < privileges.length - 1)
  								entry += " ";
  						}
  						
! 						entry += ")/" + privileges[0];
  						
  						columnEntry.put(entry, null);
  						

             reply	other threads:[~2004-06-09  5:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09  5:49 Deepak B [this message]
2004-06-09  5:58 Deepak B
2004-06-09 13:14 ` Fernando Nasser
2004-06-09 19:06 Deepak B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040609054922.37013.qmail@web61108.mail.yahoo.com \
    --to=ibetthisidisavailable@yahoo.ca \
    --cc=rhdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).