Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rootPath">
        /// Path del repository
        /// </param>
        /// <param name="context"></param>
        private SessionRepositoryFileManager(DocsPaVO.documento.SessionRepositoryContext context)
        {
            this.Context = context;

            // Verifica che il repository di sessione non sia scaduto
            this.CheckForRepositoryExpired();

            // Reperimento dell'owner persistito  e confronto con l'owner corrente
            // per verificare utilizzi non autorizzati
            DocsPaVO.utente.InfoUtente owner = (DocsPaVO.utente.InfoUtente)SessionRepositorySerializerHelper.Deserialize(Path.Combine(GetContextRepositoryPath(this.Context), "owner.dat"));

            if (!owner.dst.Equals(this.Context.Owner.dst))
            {
                throw new ApplicationException(string.Format("Utente {0} non autorizzato all'utilizzo del repository", this.Context.Owner.userId));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creazione oggetto filemanager per la gestione dei file nel repository di sessione per l'utente corrente
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static SessionRepositoryFileManager GetFileManager(DocsPaVO.documento.SessionRepositoryContext context)
        {
            //if (SessionRepositoryDisabled)
            //    // Gestione dei repository di sessione non abilitata
            //    return null;
            //else

            if (context != null)
            {
                return(new SessionRepositoryFileManager(context));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reperimento del path del repository di sessione per l'utente corrente
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private static string GetContextRepositoryPath(DocsPaVO.documento.SessionRepositoryContext context)
        {
            //if (SessionRepositoryDisabled)
            //    // Gestione dei repository di sessione non abilitata
            //    return null;
            //else

            if (context != null)
            {
                return(Path.Combine(SessionRepositoryFileManager.RepositoryRootPath, context.Token));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creazione di un nuovo repository di sessione per l'utente che ne fa richiesta
        /// </summary>
        /// <param name="infoUtente"></param>
        /// <param name="forceCreation">
        /// Se true, forza la creazione del repository indipendentemente dal fatto che i repository di sessione siano disabilitati o meno
        /// </param>
        /// <returns></returns>
        public static DocsPaVO.documento.SessionRepositoryContext NewRepository(DocsPaVO.utente.InfoUtente infoUtente, bool forceCreation)
        {
            if (!forceCreation && IsSessionRepositoryDisabled(infoUtente))
            {
                // Gestione dei repository di sessione non abilitata
                return(null);
            }
            else
            {
                DocsPaVO.documento.SessionRepositoryContext context = new DocsPaVO.documento.SessionRepositoryContext(infoUtente);

                string path = GetContextRepositoryPath(context);

                // Creazione directory del repository
                Directory.CreateDirectory(path);

                // Serializzazione owner
                SessionRepositorySerializerHelper.SerializeObject(Path.Combine(path, "owner.dat"), infoUtente);

                return(context);
            }
        }