public bool AddUserFilenet(string userID, string userPwd, string idAmministrazione, string userFullName, string userDefaultGroup) { string dst = ""; UserManager userManager = null; IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { userManager = new UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idAmministrazione); string ArchivioFile = DocsPaDocumentale_FILENET.FilenetLib.DocumentManagement.checkFolderCompliance(oLibrary); DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti(); if (!userFilenet.AddUserFilenet(userID, userDefaultGroup, ArchivioFile, userFullName)) { throw new Exception("Errore durante l'inserimento utente Filenet: " + userID); } bool result = oLibrary.Logon(userID, "", "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI); oLibrary.ChangePassword("", userPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, userID); dst = oLibrary.LogonId.ToString(); return(true); } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in AddUserFilenet = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } finally { if (dst.Length > 0) { userManager.logoutToFilenet(dst); } } }
public bool ChangeUserFilenetPassword(string username, string oldpwd, string newPwd, string idAmministrazione) { bool changed = false; string dst = string.Empty; IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { IDMObjects.Library oLibrary = this.getFileNETLib(idAmministrazione); DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti(); bool result = oLibrary.Logon(username, oldpwd, "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI); oLibrary.ChangePassword(oldpwd, newPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, username); dst = oLibrary.LogonId.ToString(); changed = true; } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in UpdateUserFilenet = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } finally { if (!string.IsNullOrEmpty(dst)) { this.logoutToFilenet(dst); } } return(changed); }
public bool UpdateUserFilenet(string username, string oldpwd, string newPwd, string userfullname, string idamministrazione) { string dst = ""; UserManager userManager = null; IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { userManager = new UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti(); if (!userFilenet.UpdateUserFilenet(username, userfullname)) { throw new Exception("Errore durante la modifica dell'utente Filenet: " + username); } bool result = oLibrary.Logon(username, oldpwd, "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI); oLibrary.ChangePassword(oldpwd, newPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, username); dst = oLibrary.LogonId.ToString(); return(true); } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in UpdateUserFilenet = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } finally { if (dst.Length > 0) { userManager.logoutToFilenet(dst); } } }