/// <summary> /// Inserimento di un utente in un ruolo /// </summary> /// <param name="idPeople"></param> /// <param name="idGruppo"></param> /// <returns></returns> public EsitoOperazione InserisciUtenteInRuolo(string idPeople, string idGruppo) { EsitoOperazione ret = new EsitoOperazione(); IQueryService qrySrvc = null; try { qrySrvc = this.GetQueryServiceInstance(); string codiceRuolo = DocsPaServices.DocsPaQueryHelper.getCodiceRuoloFromIdGroups(idGruppo); string codiceUtente = DocsPaServices.DocsPaQueryHelper.getCodiceUtente(idPeople); string query = string.Format("ALTER GROUP '{0}' ADD '{1}'", TypeGruppo.NormalizeGroupName(codiceRuolo), TypeUtente.NormalizeUserName(codiceUtente)); QueryResult queryResult = DfsHelper.executePassThrough(qrySrvc, query); logger.Debug(DEBUG_HEADER + "InserisciUtenteInRuolo completata con SUCCESSO"); return(ret); } catch (Exception ex) { String st = ex.ToString(); logger.Debug(DEBUG_HEADER + "InserisciUtenteInRuolo FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "InserisciUtenteInRuolo"; return(ret); } }
/// <summary> /// Eliminazione di un utente da gruppo di amministrazione /// </summary> /// <param name="idPeople"></param> /// <param name="idGruppo"></param> /// <returns></returns> public EsitoOperazione EliminaUtenteDaRuoloAmm(string userId, string idAmministrazione) { EsitoOperazione ret = new EsitoOperazione(); IQueryService qrySrvc = null; try { qrySrvc = this.GetQueryServiceInstance(); string codiceAmministrazione = string.Format("sys_{0}", DocsPaServices.DocsPaQueryHelper.getCodiceAmministrazione(idAmministrazione).ToLower()); string query = string.Format("ALTER GROUP '{0}' DROP '{1}'", TypeGruppo.NormalizeGroupName(codiceAmministrazione).ToLower(), TypeUtente.NormalizeUserName(userId).ToLower()); QueryResult queryResult = DfsHelper.executePassThrough(qrySrvc, query); logger.Debug(DEBUG_HEADER + "EliminaUtenteDaRuoloAmm completata con SUCCESSO"); return(ret); } catch (Exception ex) { String st = ex.ToString(); logger.Debug(DEBUG_HEADER + "EliminaUtenteDaRuoloAmm FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "EliminaUtenteDaRuoloAmm"; return(ret); } }
private void inserisciUtenteInAmministrazione(OrgUtente utente, DataObject userDataObject) { string codiceAmm = DocsPaQueryHelper.getCodiceAmministrazione(utente.IDAmministrazione); string gruppoAmm = TypeGruppo.GetGroupNameForAmministrazione(codiceAmm); try { //inserimento del nuovo utente nel gruppo associato alla amministrazione IQueryService qrySrvc = this.GetQueryServiceInstance(); DfsHelper.insertUserInGroup(TypeUtente.getUserName(utente), gruppoAmm, qrySrvc); // eventuale inserimento nel gruppo dei syadmin if (utente.Amministratore != null && utente.Amministratore != "0") { gruppoAmm = TypeGruppo.GetGroupNameForSysAdminAmministrazione(codiceAmm); DfsHelper.insertUserInGroup(TypeUtente.getUserName(utente), gruppoAmm, qrySrvc); } } catch (Exception e) { string msg = string.Format( DEBUG_HEADER + ": errore in inserimento utente {0} nel gruppo {1}: {2}", TypeUtente.getUserName(utente), gruppoAmm, e.ToString()); logger.Debug(msg); undoCreateUser(utente); throw new ApplicationException(msg, e); } }
public void InserisciUtenteInAmm(OrgUtente utente) { string codiceAmm = DocsPaQueryHelper.getCodiceAmministrazione(utente.IDAmministrazione); string gruppoAmm = TypeGruppo.GetGroupNameForAmministrazione(codiceAmm); try { //inserimento del nuovo utente nel gruppo associato alla amministrazione IQueryService qrySrvc = this.GetQueryServiceInstance(); DfsHelper.insertUserInGroup(TypeUtente.getUserName(utente), gruppoAmm, qrySrvc); } catch (Exception e) { string msg = string.Format( DEBUG_HEADER + ": errore in inserimento utente {0} nel gruppo {1}: {2}", TypeUtente.getUserName(utente), gruppoAmm, e.ToString()); logger.Debug(msg); throw new ApplicationException(msg, e); } }
/// <summary> /// Cancellazione di un ruolo in amministrazione /// </summary> /// <param name="ruolo"></param> /// <returns></returns> public EsitoOperazione EliminaRuolo(OrgRuolo ruolo) { EsitoOperazione ret = new EsitoOperazione(); string logMsg; IObjectService objSrvc = null; String repositoryName = DctmConfigurations.GetRepositoryName(); // test sui campi obbligatori if (string.IsNullOrEmpty(ruolo.Codice)) { logMsg = ERR_HEADER + "EliminaRuolo: dati insufficienti"; ret.Codice = -1; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } try { objSrvc = this.GetObjectServiceInstance(); ObjectIdentity groupIdentity = Dfs4DocsPa.getGroupIdentityByName(TypeGruppo.GetGroupName(ruolo)); checkReference(TypeGruppo.GetGroupName(ruolo), ObjectTypes.UTENTE, "user_group_name", false); ObjectIdentitySet s = new ObjectIdentitySet(groupIdentity); objSrvc.Delete(s, null); logger.Debug(DEBUG_HEADER + "EliminaRuolo completata con SUCCESSO"); return(ret); } catch (Exception ex) { String st = ex.ToString(); logger.Debug(DEBUG_HEADER + "EliminaRuolo FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "EliminaRuolo"; return(ret); } }
/// <summary> /// Impostazione / rimozione della visibilità di un singolo nodo di titolario per un ruolo /// </summary> /// <param name="nodoTitolario"></param> /// <param name="ruoloTitolario"> /// Ruolo cui deve essere associata / rimossa la visibilità verso il nodo titolario /// </param> /// <returns></returns> public bool SetAclRuoloNodoTitolario(OrgNodoTitolario nodoTitolario, OrgRuoloTitolario ruoloTitolario) { bool retValue = false; try { // Reperimento ACL associate al nodo di titolario SOLO per il ruolo richiesto CustomServices.AclDefinition aclData = AclHelper.getAclDefinition(nodoTitolario.CodiceAmministrazione, nodoTitolario.ID, ObjectTypes.NODO_TITOLARIO); List <CustomServices.AclEntry> entries = new List <CustomServices.AclEntry>(aclData.entries); //AclHelper.addBasicPermit(entries, TypeGruppo.NormalizeGroupName(ruoloTitolario.Codice), Permission.DELETE); AclHelper.addBasicPermit(entries, TypeGruppo.NormalizeGroupName(DocsPaQueryHelper.getCodiceRuoloFromIdGroups(ruoloTitolario.ID)), Permission.DELETE); aclData.entries = entries.ToArray(); CustomServices.IAclService aclService = DctmServiceFactory.GetCustomServiceInstance <CustomServices.IAclService>(UserManager.ImpersonateSuperUser()); if (ruoloTitolario.Associato) { // Impostazione visibilità del ruolo aclService.UpdateWithGrant(aclData); } else { // Rimozione visibilità del ruolo aclService.Revoke(aclData); } retValue = true; } catch (Exception ex) { retValue = false; logger.Debug("Errore in Documentum.SetAclRuoloNodoTitolario: " + ex.ToString()); } return(retValue); }
/// <summary> /// Inserimento di una nuova amministrazione nel documentale /// /// Problema delle DFS: /// come da documentazione, inizialmente gli inserimenti venivano effettuati /// tutti in un'unica operazione. Il problema è che le cartelle DNC e StampaRegistro /// venivano create nel folder HomeCabinet (oltre che normalmente nel cabinet dell'amministrazione). /// Ciò sicuramente è dovuto al fatto di inserire tutto in un'unica richiesta. /// Per ovviare a questo inconveniente, si è scelto di inserire le cartelle in 2 fasi: /// 1. inserimento cabinet 2. inserimento cartelle sottostanti /// </summary> /// <param name="info"></param> /// <returns></returns> public EsitoOperazione Insert(InfoAmministrazione info) { EsitoOperazione retValue = new EsitoOperazione(); // ACL per l'amministrazione CustomServices.AclDefinition aclDefinition = null; // Identity del cabinet dell'amministrazione ObjectIdentity cabinetIdentity = null; // Identity del gruppo di sistema associato all'amministrazione ObjectIdentity groupIdentity = null; // Identity del gruppo di sistema che contiene gli amministratori dell'amministrazione ObjectIdentity adminGroupIdentity = null; try { // Creazione del cabinet per l'amministrazione ObjectPath cabinetPath = this.GetCabinetPath(info); logger.Debug("cabinetPath " + cabinetPath); cabinetIdentity = this.GetObjectServiceInstance().CreatePath(cabinetPath, DctmConfigurations.GetRepositoryName()); // Creazione documenti ObjectIdentity documentiIdentity = new ObjectIdentity(DctmConfigurations.GetRepositoryName()); DataObject dataObjectDocumenti = new DataObject(documentiIdentity, "dm_folder"); dataObjectDocumenti.Properties.Set <string>("object_name", DocsPaAdminCabinet.FOLDER_DOCUMENTI); dataObjectDocumenti.Relationships.Add(new ReferenceRelationship(cabinetIdentity, Relationship.RELATIONSHIP_FOLDER, Relationship.ROLE_PARENT)); // Creazione folder titolario ObjectIdentity titolarioIdentity = new ObjectIdentity(DctmConfigurations.GetRepositoryName()); DataObject dataObjectTitolario = new DataObject(titolarioIdentity, "dm_folder"); dataObjectTitolario.Properties.Set <string>("object_name", DocsPaAdminCabinet.FOLDER_TITOLARIO); dataObjectTitolario.Relationships.Add(new ReferenceRelationship(cabinetIdentity, Relationship.RELATIONSHIP_FOLDER, Relationship.ROLE_PARENT)); // Creazione del gruppo di sistema associato all'amministrazione groupIdentity = new ObjectIdentity(DctmConfigurations.GetRepositoryName()); DataObject groupData = new DataObject(groupIdentity, ObjectTypes.GRUPPO); groupData.Properties.Set <string>("group_name", TypeGruppo.GetGroupNameForAmministrazione(info.Codice)); groupData.Properties.Set <string>("description", "Gruppo di sistema: tutti gli utenti dell'amministrazione " + info.Codice); groupData.Properties.Set <string>("group_class", "group"); // Creazione del gruppo di sistema che contiene gli amministratori dell'amministrazione //adminGroupIdentity = new ObjectIdentity(DctmConfigurations.GetRepositoryName().ToLower()); //<- PERCHE' TO LOWER!? (Vecchio 6.0) adminGroupIdentity = new ObjectIdentity(DctmConfigurations.GetRepositoryName()); DataObject adminGroupData = new DataObject(adminGroupIdentity, ObjectTypes.GRUPPO); adminGroupData.Properties.Set <string>("group_name", TypeGruppo.GetGroupNameForSysAdminAmministrazione(info.Codice)); adminGroupData.Properties.Set <string>("description", "Gruppo di sistema: sysadmin dell'amministrazione " + info.Codice); adminGroupData.Properties.Set <string>("group_class", "group"); DataPackage dataPackage = new DataPackage(); dataPackage.AddDataObject(dataObjectDocumenti); dataPackage.AddDataObject(dataObjectTitolario); dataPackage.AddDataObject(groupData); dataPackage.AddDataObject(adminGroupData); dataPackage = this.GetObjectServiceInstance().Create(dataPackage, null); if (dataPackage.DataObjects.Count == 0) { throw new ApplicationException("Nessun oggetto creato"); } else { dataObjectDocumenti = dataPackage.DataObjects[0]; dataObjectTitolario = dataPackage.DataObjects[1]; groupIdentity = dataPackage.DataObjects[2].Identity; adminGroupIdentity = dataPackage.DataObjects[3].Identity; // Creazione AclDefinition per tutti gli oggetti dell'amministrazione aclDefinition = this.CreateAclAdmin(info); // Associazione dell'ACL appena creata con gli oggetti dell'amministrazione AclHelper.setAclObjectProperties(dataObjectDocumenti.Properties, aclDefinition); AclHelper.setAclObjectProperties(dataObjectTitolario.Properties, aclDefinition); dataPackage = new DataPackage(); dataPackage.AddDataObject(dataObjectDocumenti); dataPackage.AddDataObject(dataObjectTitolario); dataPackage = this.GetObjectServiceInstance().Update(dataPackage, null); logger.Debug(string.Format("Documentum.InsertAmministrazione: {0} oggetti creati per nuova amministrazione {1}, CabinetPath {2}", dataPackage.DataObjects.Count.ToString(), info.Codice, cabinetPath.Path)); } } catch (Exception ex) { // In caso di errore, viene annullata la procedura // rimuovendo gli oggetti finora inseriti if (aclDefinition != null) { try { // Rimozione ACL appena inserita this.DeleteAclAdmin(aclDefinition); } catch (Exception exInner) { logger.Debug(string.Format("Documentum.InsertAmministrazione: errore in rimozione acl '{0}'", aclDefinition.name)); } } // Inserimento nell'identityset degli oggetti da rimuovere ObjectIdentitySet createdObjects = new ObjectIdentitySet(); if (cabinetIdentity != null && cabinetIdentity.ValueType == ObjectIdentityType.OBJECT_ID) { createdObjects.AddIdentity(cabinetIdentity); } if (groupIdentity != null && groupIdentity.ValueType == ObjectIdentityType.OBJECT_ID) { createdObjects.AddIdentity(groupIdentity); } if (adminGroupIdentity != null && adminGroupIdentity.ValueType == ObjectIdentityType.OBJECT_ID) { createdObjects.AddIdentity(adminGroupIdentity); } if (createdObjects.Identities.Count > 0) { OperationOptions opts = new OperationOptions(); opts.DeleteProfile = this.CreateDeleteProfile(); try { // Rimozione di tutti gli oggetti creati per l'amministrazione this.GetObjectServiceInstance().Delete(createdObjects, opts); } catch (Exception exInner) { logger.Debug(string.Format("Documentum.InsertAmministrazione: errore in rimozione cabinet amministrazione '{0}'", info.Codice)); } } logger.Debug(string.Format("Errore in Documentum.InsertAmministrazione:\n{0}", ex.ToString())); retValue.Codice = -1; retValue.Descrizione = string.Format("Errore nella creazione del cabinet {0} in Documentum", info.Codice); } return(retValue); }
/////// <summary> /////// Reperimento di tutti gli utenti dell'amministrazione /////// </summary> /////// <param name="infoUtente"></param> /////// <param name="amministrazione"></param> /////// <returns></returns> ////private static string[] GetUtenti(InfoAmministrazione amm) ////{ //// List<string> list = new List<string>(); //// using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) //// { //// string commandText = string.Format("SELECT user_id FROM PEOPLE WHERE id_amm = {0}", amm.IDAmm); //// using (System.Data.IDataReader reader = dbProvider.ExecuteReader(commandText)) //// { //// while (reader.Read()) //// { //// list.Add(DocsPaUtils.Data.DataReaderHelper.GetValue<string>(reader, "user_id", false)); //// } //// } //// } //// return list.ToArray(); ////} /// <summary> /// Cancellazione di un'amministrazione nel documentale. /// NB: L'operazione di rimozione deve essere effettuata con le credenziali /// dell'utente superuser /// </summary> /// <param name="info"></param> /// <param name="ruoliAmministrazione"> /// Ruoli docspa da rimuovere in documentum /// </param> /// <returns></returns> public EsitoOperazione Delete(InfoAmministrazione info, string[] ruoliAmministrazione) { logger.Debug(string.Format("Documentum.DeleteAmministrazione: inizio rimozione amministrazione. Codice: '{0}'", info.Codice)); EsitoOperazione retValue = new EsitoOperazione(); try { ObjectIdentitySet identitySet = new ObjectIdentitySet(); // Reperimento degli oggetti Identity relativi a tutti i gruppi e gli utenti dell'amministrazione IQueryService queryService = DctmServiceFactory.GetServiceInstance <IQueryService>(this.InfoUtente.dst); string[] users = Dfs4DocsPa.getUsersSystemGroup(info.Codice, queryService); // Cancellazione di tutti gli utenti legati al cabinet / amministrazione foreach (string userId in users) { string normalizedUserId = TypeUtente.NormalizeUserName(userId); // Reperimento oggetto identity per ogni utente identitySet.AddIdentity(Dfs4DocsPa.getUserIdentityByName(normalizedUserId)); // Cancellazione dell'home cabinet per ogni 'utente identitySet.AddIdentity(Dfs4DocsPa.getUserHomeFolderIdentity(normalizedUserId)); logger.Debug(string.Format("Documentum.DeleteAmministrazione: rimozione utente '{0}'", normalizedUserId)); } //foreach (string userId in GetUtenti(info)) //{ // string normalizedUserId = TypeUtente.NormalizeUserName(userId); // ObjectIdentity id = Dfs4DocsPa.getUserIdentityByName(normalizedUserId, queryService); // if (id != null) // { // identitySet.AddIdentity(id); // // Cancellazione dell'home cabinet per ogni 'utente // identitySet.AddIdentity(Dfs4DocsPa.getUserHomeFolderIdentity(normalizedUserId)); // } //} // Cancellazione del ruolo di sistema dell'amministrazione ObjectIdentity identity = Dfs4DocsPa.getSystemGroupIdentity(info.Codice, queryService); if (identity != null) { identitySet.AddIdentity(identity); } // Cancellazione del ruolo di sistema degli amministratori dell'amministrazione identity = Dfs4DocsPa.getAmmSystemGroupIdentity(info.Codice, queryService); if (identity != null) { identitySet.AddIdentity(identity); } // Cancellazione di tutti gli gruppi legati al cabinet / amministrazione foreach (string docspaGroupName in ruoliAmministrazione) { string normalizedGroupName = TypeGruppo.NormalizeGroupName(docspaGroupName); ObjectIdentity groupIdentity = Dfs4DocsPa.getGroupIdentityByName(normalizedGroupName, queryService); if (groupIdentity != null) { identitySet.AddIdentity(groupIdentity); logger.Debug(string.Format("Documentum.DeleteAmministrazione: rimozione ruolo '{0}'", normalizedGroupName)); } } // Reperimento oggetto Identity relativamente al cabinet da rimuovere identitySet.AddIdentity(Dfs4DocsPa.getCabinetIdentity(info.Codice)); OperationOptions opts = new OperationOptions(); opts.DeleteProfile = this.CreateDeleteProfile(); IObjectService objectService = this.GetObjectServiceInstance(); objectService.Delete(identitySet, opts); logger.Debug(string.Format("Documentum.DeleteAmministrazione: rimozione amministrazione. Codice: '{0}'", info.Codice)); // Cancellazione di tutte le ACL create per gli oggetti dell'amministrazione this.DeleteAcl(info); logger.Debug(string.Format("Documentum.DeleteAmministrazione: rimozione ACL amministrazione. Codice: '{0}'", info.Codice)); } catch (Exception ex) { logger.Debug(string.Format("Errore in Documentum.DeleteAmministrazione:\n{0}", ex.ToString())); retValue.Codice = -1; retValue.Descrizione = string.Format("Errore nella rimozione del cabinet {0} in Documentum", info.Codice); } return(retValue); }
/// <summary> /// Modifica dei dati di un utente in amministrazione /// </summary> /// <param name="utente"></param> /// <returns></returns> public EsitoOperazione ModificaUtente(OrgUtente utente) { EsitoOperazione ret = new EsitoOperazione(); string logMsg = string.Empty; IObjectService objSrvc = null; IQueryService qrySvc = null; string repositoryName = DctmConfigurations.GetRepositoryName(); bool wasSysAdmin = false; bool isSysAdmin = false; string gruppoSysAdm; string codiceAmm; // test sui campi obbligatori if (string.IsNullOrEmpty(utente.Codice) || string.IsNullOrEmpty(utente.Email) || string.IsNullOrEmpty(utente.IDPeople) || string.IsNullOrEmpty(utente.UserId)) { logMsg = ERR_HEADER + "ModificaUtente: dati insufficienti"; ret.Codice = -1; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } try { objSrvc = this.GetObjectServiceInstance(); qrySvc = this.GetQueryServiceInstance(); ObjectIdentity userIdentity = Dfs4DocsPa.getUserIdentityByName(TypeUtente.getUserName(utente)); // non è possibile cambiare il nome di un utente List <string> filters = new List <string>(); filters.Add("user_name"); DataObject oldData = DfsHelper.getAllPropsAndFolders(objSrvc, userIdentity, filters, false); Property oldName = oldData.Properties.Get("user_name"); if (oldName == null) { ret.Codice = -1; logMsg = ERR_HEADER + "ModificaUtente: impossibile leggere il vecchio nome dell'utente"; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } if (!oldName.GetValueAsString().Equals(utente.UserId, StringComparison.OrdinalIgnoreCase)) { ret.Codice = -1; logMsg = ERR_HEADER + "ModificaUtente: non è possibile modificare il nome dell'utente"; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } // dobbiamo capire se prima dell'update era sysAdmin oppure no codiceAmm = DocsPaQueryHelper.getCodiceAmministrazione(utente.IDAmministrazione); gruppoSysAdm = TypeGruppo.GetGroupNameForSysAdminAmministrazione(codiceAmm); wasSysAdmin = DfsHelper.isUserMemberOf(TypeUtente.getUserName(utente), gruppoSysAdm, qrySvc); isSysAdmin = (utente.Amministratore != null && utente.Amministratore != "0"); // verifico se sia stata modificata la password o meno // if (!string.IsNullOrEmpty(utente.Password)) // { // eliminato controllo su presenza password, gli altri dati dell'utente devono essere modificati // anche senza un cambio password (speriamo almeno..) Necessario per replicare stato attivazione rispetto a docspa. // il campo password non viene passato se non è valorizzato DataObject userData = new DataObject(userIdentity, ObjectTypes.UTENTE); // Reperimento properties utente userData.Properties.Properties.AddRange(Dfs4DocsPa.getUserProperties(utente)); DataPackage pkg = new DataPackage(userData); pkg = objSrvc.Update(pkg, null); if (pkg.DataObjects.Count > 0) { // eventuale inserimento nel gruppo dei syadmin if (isSysAdmin && !wasSysAdmin) { DfsHelper.insertUserInGroup(TypeUtente.getUserName(utente), gruppoSysAdm, qrySvc); } else if (wasSysAdmin && !isSysAdmin) { DfsHelper.removeUserFromGroup(TypeUtente.getUserName(utente), gruppoSysAdm, qrySvc); } ret.Codice = 0; ret.Descrizione = string.Empty; logger.Debug(DEBUG_HEADER + "ModificaUtente completata con SUCCESSO"); } else { throw new ApplicationException(); } /** } * else * { * ret.Codice = 0; * ret.Descrizione = string.Empty; * * logger.Debug(DEBUG_HEADER + "ModificaUtente completata con SUCCESSO"); * } */ return(ret); } catch (Exception ex) { String st = ex.ToString(); logger.Error(DEBUG_HEADER + "ModificaUtente FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "ModificaUtente"; return(ret); } }
/// <summary> /// Modifica dei metadati di un ruolo /// </summary> /// <param name="ruolo"></param> /// <returns></returns> public EsitoOperazione ModificaRuolo(OrgRuolo ruolo) { EsitoOperazione ret = new EsitoOperazione(); string logMsg; IObjectService objSrvc = null; string repositoryName = DctmConfigurations.GetRepositoryName(); // test sui campi obbligatori if (string.IsNullOrEmpty(ruolo.Codice) || string.IsNullOrEmpty(ruolo.Descrizione)) { ret.Codice = -1; logMsg = ERR_HEADER + "ModificaRuolo: dati insufficienti"; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } // il campo Codice corrisponde a: // (ETDOCS) DPA_CORR_GLOBALI.VAR_COD_RUBRICA varchar(128) // (DCTM) dm_group.group_name string(32) // se mi viene passato un codice di lunghezza > 32 lancio un'eccezione if (ruolo.Codice.Length > 32) { ret.Codice = -1; logMsg = ERR_HEADER + "ModificaRuolo: campo CODICE supera la lunghezza massima (32)"; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } try { objSrvc = this.GetObjectServiceInstance(); ObjectIdentity groupIdentity = Dfs4DocsPa.getGroupIdentityByName(TypeGruppo.GetGroupName(ruolo)); // non è possibile cambiare il nome di un gruppo //List<string> filters = new List<string>(); //filters.Add("group_name"); //DataObject oldData = DfsHelper.getAllPropsAndFolders(objSrvc, groupIdentity, filters, false); //Property oldName = oldData.Properties.Get("group_name"); //if (oldName == null) //{ // ret.Codice = -1; // logMsg = ERR_HEADER + "ModificaRuolo: impossibile leggere il vecchio nome del gruppo"; // ret.Descrizione = logMsg; // logger.Debug(logMsg); // return ret; //} //if (!oldName.GetValueAsString().Equals(ruolo.Codice, StringComparison.OrdinalIgnoreCase)) //{ // ret.Codice = -1; // logMsg = ERR_HEADER + "ModificaRuolo: non è possibile modificare il nome del gruppo"; // ret.Descrizione = logMsg; // logger.Debug(logMsg); // return ret; //} DataObject dataObject = new DataObject(groupIdentity, ObjectTypes.GRUPPO); dataObject.Properties.Properties.AddRange(Dfs4DocsPa.getGroupProperties(ruolo, true)); DataPackage dataPackage = new DataPackage(dataObject); dataPackage = objSrvc.Update(dataPackage, null); if (dataPackage.DataObjects.Count > 0) { ret.Codice = 0; ret.Descrizione = string.Empty; logger.Debug(DEBUG_HEADER + "ModificaRuolo completata con SUCCESSO"); return(ret); } else { throw new ApplicationException(); } } catch (Exception ex) { string st = ex.ToString(); logger.Debug(DEBUG_HEADER + "ModificaRuolo FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "ModificaRuolo"; return(ret); } }