- Added support for ADD-KEY and DELETE-KEY for GnomeKeyring store.

- Bug 142183:Added code to prevent users from deleting "GKPassword"
  Key in Keyring store.
...................................................................
This commit is contained in:
smanojna 2006-01-10 07:39:48 +00:00
parent 7b685e2987
commit 8348ecdb4a
4 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jan 10 13:20:06 IST 2006 - smanojna@novell.com
- Added support for ADD-KEY and DELETE-KEY for GnomeKeyring store.
- Bug 142183:Added code to prevent users from deleting "GKPassword"
Key in Keyring store.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jan 9 17:38:33 MST 2006 - jnorman@novell.com Mon Jan 9 17:38:33 MST 2006 - jnorman@novell.com

View File

@ -583,9 +583,7 @@ namespace Novell.CASA.GUI
case Common.STORE_GNOMEKEYRING: case Common.STORE_GNOMEKEYRING:
if( 0 != objGnomeKeyring.tvSecretIDGnomeKeyring.Selection.CountSelectedRows() ) if( 0 != objGnomeKeyring.tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
{ {
//mmiNew.Sensitive = mmiNewKey.Sensitive = true; mmiNew.Sensitive = mmiNewKey.Sensitive = true;
mmiNew.Sensitive = true;
mmiNewKey.Sensitive = false;
} }
else else
{ {

View File

@ -199,7 +199,7 @@ public class GnomeKeyring : Store
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime); menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
if( 0 != tvSecretIDGnomeKeyring.Selection.CountSelectedRows() ) if( 0 != tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
cmiNewKey.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = false; cmiLink.Sensitive = cmiCopy.Sensitive = false;
else else
cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false; cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
} }
@ -263,8 +263,8 @@ public class GnomeKeyring : Store
} }
tvKeyValue.Model = tsKeyValue; tvKeyValue.Model = tsKeyValue;
//entryKey.HasFocus = true; entryKey.HasFocus = true;
entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = false; //entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = false;
} }
} }
catch(Exception exp) catch(Exception exp)
@ -398,7 +398,7 @@ public class GnomeKeyring : Store
TreeIter iterKey; TreeIter iterKey;
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey)) if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
if( false == (bool)tsKeyValue.GetValue(iterKey,3) ) if( "GKPassword" != (string)tsKeyValue.GetValue(iterKey,0) && false == (bool)tsKeyValue.GetValue(iterKey,3) )
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0)); arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
if( 0 != tvKeyValue.Selection.CountSelectedRows() ) if( 0 != tvKeyValue.Selection.CountSelectedRows() )
@ -407,8 +407,11 @@ public class GnomeKeyring : Store
TreeIter iter; TreeIter iter;
tvKeyValue.Selection.GetSelected (out model, out iter); tvKeyValue.Selection.GetSelected (out model, out iter);
tsKeyValue.Remove(ref iter); if( "GKPassword" != (string)tsKeyValue.GetValue(iter,0) )
tvKeyValue.ColumnsAutosize(); {
tsKeyValue.Remove(ref iter);
tvKeyValue.ColumnsAutosize();
}
} }
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - END"); Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - END");

View File

@ -653,7 +653,8 @@ namespace Novell.CASA.GUI {
XmlNode keyParentNode = key.ParentNode; XmlNode keyParentNode = key.ParentNode;
key.ParentNode.RemoveChild(key); key.ParentNode.RemoveChild(key);
//Console.WriteLine("EXECUTING OPERATION_DELETE_KEY:Deleting"+ccfSecretPath);//FIXME:Remove this line //Console.WriteLine("EXECUTING OPERATION_DELETE_KEY:Deleting"+ccfSecretPath);//FIXME:Remove this line
ad.SetSecret(keyParentNode,storeIDentifier); //ad.SetSecret(keyParentNode,storeIDentifier);
ad.SetSecret(keyParentNode,Common.OPERATION_MODIFY_KEY,storeIDentifier);
} }
} }
else if( Common.OPERATION_ADD_SECRET == operation ) else if( Common.OPERATION_ADD_SECRET == operation )
@ -729,7 +730,7 @@ namespace Novell.CASA.GUI {
} }
else else
{//Wallet:CASAwallet exists. Hence check for folder {//Wallet:CASAwallet exists. Hence check for folder
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']"; //Password ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']"; //Passwords
XmlNodeList keychainFolderNodeList = root.SelectNodes(ccfKeyChainPath); XmlNodeList keychainFolderNodeList = root.SelectNodes(ccfKeyChainPath);
if( (null == keychainFolderNodeList) || (0 == keychainFolderNodeList.Count) ) if( (null == keychainFolderNodeList) || (0 == keychainFolderNodeList.Count) )
{//folderName:Password does not exist. Hence create folder & type {//folderName:Password does not exist. Hence create folder & type
@ -777,11 +778,12 @@ namespace Novell.CASA.GUI {
//Console.WriteLine("ADD_SECRET:ccfKeyChainPath="+ccfKeyChainPath);//FIXME:Remove this line //Console.WriteLine("ADD_SECRET:ccfKeyChainPath="+ccfKeyChainPath);//FIXME:Remove this line
XmlNodeList secretNodeList = root.SelectNodes(ccfKeyChainPath); XmlNodeList secretNodeList = root.SelectNodes(ccfKeyChainPath);
XmlNode SecretNode = secretNodeList.Item(0); XmlNode SecretNode = secretNodeList.Item(0);
XmlNode lastChild = SecretNode.LastChild; //The newly added secret SecretNode.AppendChild(newSecretElement); //Add the new Secret
XmlNode lastChild = SecretNode.LastChild; //Get The newly added secret
if(lastChild!=null) if(lastChild!=null)
{ {
//Console.WriteLine("EXECUTING OPERATION_ADD_SECRET:Adding"+ccfSecretPath);//FIXME:Remove this line Console.WriteLine("EXECUTING OPERATION_ADD_SECRET:Adding"+ccfSecretPath);//FIXME:Remove this line
ad.SetSecret(lastChild,operation,storeIDentifier); ad.SetSecret(lastChild,operation,storeIDentifier); //and set it
} }
}//STORE_KDEWALLET }//STORE_KDEWALLET
@ -797,7 +799,8 @@ namespace Novell.CASA.GUI {
XmlNode lastChild = keyNode.LastChild; XmlNode lastChild = keyNode.LastChild;
keyNode.InsertBefore(newKeyElement,lastChild); keyNode.InsertBefore(newKeyElement,lastChild);
//ShowDocOnConsole("JUST BEFORE CALL TO SETSECRET-ADDKEY");//FIXME:Remove this //ShowDocOnConsole("JUST BEFORE CALL TO SETSECRET-ADDKEY");//FIXME:Remove this
int errcode=ad.SetSecret(keyNode,Common.OPERATION_ADD_SECRET,storeIDentifier); //int errcode=ad.SetSecret(keyNode,Common.OPERATION_ADD_SECRET,storeIDentifier);
int errcode=ad.SetSecret(keyNode,Common.OPERATION_MODIFY_KEY,storeIDentifier);
//ShowDocOnConsole("SetSecret returned errcode="+errcode);//FIXME:Remove this //ShowDocOnConsole("SetSecret returned errcode="+errcode);//FIXME:Remove this
} }