Esempio n. 1
0
        /// <summary>
        /// verifica che il server DCTM risponda correttamente, effettuando un controllo sulle credenziali dell'amministratore
        /// </summary>
        /// <returns></returns>
        public virtual bool Checkconnection()
        {
            bool   retValue = false;
            string userAdm  = DctmConfigurations.GetDocumentumSuperUser();

            //loginResult = UserLogin.LoginResult.APPLICATION_ERROR;

            try
            {
                RepositoryIdentity identity = DctmServices.DctmRepositoryIdentityHelper.GetIdentity(
                    DctmConfigurations.GetRepositoryName(),
                    userAdm,
                    DctmConfigurations.GetDocumentumSuperUserPwd(),
                    "");

                string token = DctmServices.DctmRepositoryIdentityHelper.CreateAuthenticationToken(identity);

                IObjectService objectService = DctmServiceFactory.GetServiceInstance <IObjectService>(token);

                Qualification qual = new Qualification("dm_docbaseid_map enable(RETURN_TOP 1)");

                ObjectIdentity objectIdentity = new ObjectIdentity(qual, DctmConfigurations.GetRepositoryName());
                objectIdentity.ValueType          = ObjectIdentityType.QUALIFICATION;
                objectIdentity.valueTypeSpecified = true;

                DataPackage dataPackage = objectService.Get(new ObjectIdentitySet(objectIdentity), null);

                retValue = (dataPackage != null);
            }

            /*
             *          catch (Emc.Documentum.FS.Runtime.AuthenticationException exAuth)
             *          {
             *              //AuthenticationException - Exception in com.emc.documentum.fs.rt
             *              //Exception which is raised when authentication errors occur
             *              //  loginResult = DocsPaVO.utente.UserLogin.LoginResult.UNKNOWN_DTCM_USER;
             *              retValue = false;
             *
             *              logger.Error(string.Format("Credenziali utente DTCM non valide: '{0}'", userAdm + " " + exAuth.Message));
             *          }
             */
            catch (Emc.Documentum.FS.Runtime.ServiceInvocationException exServiceInvocation)
            {
                //AuthenticationException - Exception in com.emc.documentum.fs.rt
                //Exception which is raised when authentication errors occur
                //  loginResult = DocsPaVO.utente.UserLogin.LoginResult.DTCM_SERVICE_NO_CONTACT;
                retValue = false;

                logger.Error(string.Format("Errore nel tentativo di contattare i servizi DCTM: '{0}'", userAdm + " " + exServiceInvocation.Message));
            }

            /*
             *          catch (Emc.Documentum.FS.Runtime.ServiceException exService)
             *          {
             *              //AuthenticationException - Exception in com.emc.documentum.fs.rt
             *              //Exception which is raised when authentication errors occur
             *              //  loginResult = DocsPaVO.utente.UserLogin.LoginResult.DTCM_SERVICE_NO_CONTACT;
             *              retValue = false;
             *
             *              logger.Error(string.Format("Errore nel tentativo di contattare i servizi DTCM: '{0}'", userAdm + " " + exService.Message));
             *          }
             */
            catch (Exception ex)
            {
                //AuthenticationException - Exception in com.emc.documentum.fs.rt
                //Exception which is raised when authentication errors occur
                //  loginResult = DocsPaVO.utente.UserLogin.LoginResult.UNKNOWN_USER;
                retValue = false;

                logger.Error(string.Format("Error durante il controllo checkpage utente : '{0}'", userAdm + " errore: " + ex.Message));
            }

            return(retValue);
        }
Esempio n. 2
0
        /// <summary>
        /// Impersonate come utente superuser documentum
        /// </summary>
        /// <returns></returns>
        internal static string ImpersonateSuperUser()
        {
            // Per creare il folder per contenere i documenti, è necessario fare l'impersonate come utente amministratore (superuser in dctm)
            RepositoryIdentity superIdentity = DctmRepositoryIdentityHelper.GetIdentity(DctmConfigurations.GetRepositoryName(),
                                                                                        DctmConfigurations.GetDocumentumSuperUser(),
                                                                                        DctmConfigurations.GetDocumentumSuperUserPwd(),
                                                                                        string.Empty);

            return(DctmRepositoryIdentityHelper.CreateAuthenticationToken(superIdentity));
        }