Exemplo n.º 1
0
        public virtual void DeleteEntry(string ifolderID, string entryID)
        {
            Hashtable exceptions = new Hashtable();

            string accessID = GetAccessID();

            string[] ids = entryID.Split(new char[] { ',', ' ' });

            foreach (string id in ids)
            {
                if (id.Length > 0)
                {
                    try
                    {
                        iFolderEntry.DeleteEntry(ifolderID, id, accessID);
                    }
                    catch (Exception e)
                    {
                        exceptions.Add(id, e);
                    }
                }
            }

            SmartException.Throw(exceptions);
        }
Exemplo n.º 2
0
        public virtual int GetiFolderLimitPolicyStatus(string userID)
        {
            long         userpolicy = 0, syspolicy = 0;
            UserPolicy   user     = null;
            SystemPolicy system   = null;
            string       accessID = null;

            if (userID == null)
            {
                accessID = GetAccessID();                 //new iFolder
            }
            else
            {
                accessID = userID;                 // transfer of ownership
            }
            int result = 1;

            try
            {
                iFolderUserDetails userdetails = iFolderUserDetails.GetDetails(accessID);
                user       = UserPolicy.GetPolicy(accessID);
                system     = SystemPolicy.GetPolicy();
                userpolicy = user.NoiFoldersLimit;
                syspolicy  = system.NoiFoldersLimit;

                if (userpolicy != -1 && userpolicy != -2)
                {
                    if (userpolicy <= userdetails.OwnediFolderCount)
                    {
                        result = 0;
                    }
                }
                else
                {
                    if (Simias.Service.Manager.LdapServiceEnabled == true)
                    {
                        int groupStatus = UserPolicy.GetUserGroupiFolderLimitPolicy(accessID, userdetails.OwnediFolderCount);
                        if (groupStatus == 0)
                        {
                            return(result);
                        }
                        else if (groupStatus == -1)
                        {
                            result = 0;
                        }
                    }
                    if (syspolicy <= userdetails.OwnediFolderCount && syspolicy != -1)
                    {
                        result = 0;
                    }
                }
                return(result);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }
            return(result);
        }
Exemplo n.º 3
0
 public virtual void SetFileLength(string ifolderID, string nodeID, long length)
 {
     try
     {
         iFolderEntry.SetFileLength(ifolderID, nodeID, GetAccessID(), length);
     }
     catch (Exception e)
     {
         SmartException.Throw(e);
     }
 }
Exemplo n.º 4
0
        public virtual void SetiFolderPolicy(iFolderPolicy policy)
        {
            try
            {
                string accessID = GetAccessID();

                iFolderPolicy.SetPolicy(policy, accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }
        }
Exemplo n.º 5
0
        public virtual void SetSetting(string name, string value)
        {
            try
            {
                Settings.SetUserSetting(GetAccessID(), name, value);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return;
        }
Exemplo n.º 6
0
        public virtual bool ShowTabDetails(string PassPhrase, string EncryptionAlgorithm)
        {
            bool result = true;

            try
            {
                result = iFolder.ShowTabDetails(PassPhrase, EncryptionAlgorithm);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }
            return(result);
        }
Exemplo n.º 7
0
        public virtual iFolderEntry CreateEntry(string ifolderID, string parentID, iFolderEntryType type, string entryName)
        {
            iFolderEntry result = null;

            try
            {
                result = iFolderEntry.CreateEntry(ifolderID, parentID, type, entryName, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 8
0
        public virtual iFolderEntry GetEntryByPath(string ifolderID, string entryPath)
        {
            iFolderEntry result = null;

            try
            {
                result = iFolderEntry.GetEntryByPath(ifolderID, entryPath, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 9
0
        public virtual iFolderEntrySet GetEntries(string ifolderID, string entryID, int index, int max)
        {
            iFolderEntrySet result = null;

            try
            {
                result = iFolderEntry.GetEntries(ifolderID, entryID, index, max, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 10
0
        public virtual iFolderEntrySet GetMatchedEntries(string ifolderID, string entryID, string[] folder)
        {
            iFolderEntrySet result = null;

            try
            {
                result = iFolderEntry.GetMatchedEntries(ifolderID, entryID, folder, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 11
0
        public virtual string GetSetting(string name)
        {
            string result = null;

            try
            {
                result = Settings.GetUserSetting(GetAccessID(), name);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 12
0
 public virtual void CloseFile(string file)
 {
     try
     {
         if (Session[file] != null)
         {
             (Session[file] as iFolderFile).Close();
             Session[file] = null;
         }
     }
     catch (Exception e)
     {
         SmartException.Throw(e);
     }
 }
Exemplo n.º 13
0
        public virtual iFolderEntrySet GetEntriesByName(string ifolderID, string parentID, SearchOperation operation, string pattern, int index, int max)
        {
            iFolderEntrySet result = null;

            try
            {
                result = iFolderEntry.GetEntriesByName(ifolderID, parentID, operation, pattern, index, max, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 14
0
        public virtual iFolderPolicy GetiFolderPolicy(string ifolderID)
        {
            iFolderPolicy result = null;

            try
            {
                string accessID = GetAccessID();
                result = iFolderPolicy.GetPolicy(ifolderID, accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 15
0
        public virtual iFolderSet GetiFoldersByName(SearchOperation operation, string pattern, int index, int max)
        {
            iFolderSet result = null;

            try
            {
                Authorize();

                result = iFolder.GetiFoldersByMember(GetUserID(), MemberRole.Any, operation, pattern, index, max, GetAccessID());
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 16
0
        public virtual iFolderSet GetiFolders(int index, int max)
        {
            iFolderSet result = null;

            try
            {
                string accessID = GetAccessID();

                result = iFolder.GetiFoldersByMember(accessID, MemberRole.Any, index, max, accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 17
0
        public virtual UserPolicy GetAuthenticatedUserPolicy()
        {
            UserPolicy result = null;

            try
            {
                string accessID = GetAccessID();

                result = UserPolicy.GetPolicy(accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 18
0
 public virtual void WriteFile(string file, byte[] buffer)
 {
     try
     {
         if (Session[file] != null)
         {
             (Session[file] as iFolderFile).Write(buffer);
         }
         else
         {
             throw new FileNotOpenException(file);
         }
     }
     catch (Exception e)
     {
         SmartException.Throw(e);
     }
 }
Exemplo n.º 19
0
        public virtual string OpenFileWrite(string ifolderID, string entryID, long length)
        {
            string id = null;

            try
            {
                iFolderFile file = new iFolderFile(ifolderID, entryID, GetAccessID());
                file.OpenWrite(length);
                id          = file.ID;
                Session[id] = file;
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(id);
        }
Exemplo n.º 20
0
        public virtual iFolder CreateiFolder(string name, string description, bool ssl, string encryptionAlgorithm, string PassPhrase)
        {
            iFolder result = null;

            try
            {
                Authorize();

                string accessID = GetAccessID();
                result = iFolder.CreateiFolder(name, accessID, description, accessID, ssl, encryptionAlgorithm, PassPhrase);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 21
0
        public virtual iFolderSet GetiFoldersBySearch(MemberRole role, DateTime after, SearchOperation operation, string pattern, int index, int max)
        {
            iFolderSet result = null;

            try
            {
                Authorize();

                string accessID = GetAccessID();

                result = iFolder.GetiFoldersByMember(accessID, role, after, operation, pattern, index, max, accessID);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 22
0
        public virtual int GetEncryptionPolicy()
        {
            UserPolicy   user = null;
            SystemPolicy system = null;
            int          SysEncrPolicy = 0, UserEncrPolicy = 0, securityStatus = 0;

            try
            {
                string accessID = GetAccessID();
                user           = UserPolicy.GetPolicy(accessID);
                system         = SystemPolicy.GetPolicy();
                UserEncrPolicy = user.EncryptionStatus;
                SysEncrPolicy  = system.EncryptionStatus;
                int GroupEncrPolicy = UserPolicy.GetUserGroupEncryptionPolicy(accessID);
                securityStatus += DeriveStatus(SysEncrPolicy, GroupEncrPolicy, UserEncrPolicy, UserEncrPolicy);
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }
            return(securityStatus);
        }
Exemplo n.º 23
0
        public virtual byte[] ReadFile(string file, int size)
        {
            byte[] result = null;

            try
            {
                if (Session[file] != null)
                {
                    result = (Session[file] as iFolderFile).Read(size);
                }
                else
                {
                    throw new FileNotOpenException(file);
                }
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            return(result);
        }
Exemplo n.º 24
0
        public virtual void RemoveMembership(string ifolderID)
        {
            Hashtable exceptions = new Hashtable();

            try
            {
                Authorize();

                string accessID = GetAccessID();

                string[] ids = ifolderID.Split(new char[] { ',', ' ' });

                foreach (string id in ids)
                {
                    if (id.Length > 0)
                    {
                        try
                        {
                            // NOTE: the accessID on this call in null, because
                            // we want the user to be able to remove themselves
                            // from any iFolder regardless of rights
                            iFolderUser.RemoveMember(id, accessID, null);
                        }
                        catch (Exception e)
                        {
                            exceptions.Add(id, e);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SmartException.Throw(e);
            }

            SmartException.Throw(exceptions);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Throw a Smart SOAP Exception
        /// </summary>
        /// <param name="exceptions"></param>
        public static void Throw(Hashtable exceptions)
        {
            if (exceptions.Count < 1)
            {
                // do nothing
            }
            else if (exceptions.Count == 1)
            {
                SmartException.Throw((Exception)(new ArrayList(exceptions.Values))[0]);
            }
            else
            {
                XmlDocument doc  = new XmlDocument();
                XmlNode     node = doc.CreateNode(XmlNodeType.Element,
                                                  SoapException.DetailElementName.Name,
                                                  SoapException.DetailElementName.Namespace);

                XmlNode child;
                XmlNode attr;

                string message = null;

                foreach (string id in exceptions.Keys)
                {
                    Exception e = (Exception)exceptions[id];

                    // exception node
                    child = doc.CreateNode(XmlNodeType.Element,
                                           OriginalExceptionElementName,
                                           SoapException.DetailElementName.Namespace);

                    // exception type
                    string type = e.GetType().ToString();
                    attr = doc.CreateNode(XmlNodeType.Attribute,
                                          TypeAttributeName, SoapException.DetailElementName.Namespace);
                    attr.Value = type;
                    child.Attributes.SetNamedItem(attr);

                    // message
                    if (message == null)
                    {
                        message = String.Format("{0}-{1}", type, e.Message);
                    }
                    else
                    {
                        message = String.Format("{0}, {1}-{2}", message, type, e.Message);
                    }

                    // exception id
                    attr = doc.CreateNode(XmlNodeType.Attribute,
                                          IDAttributeName, SoapException.DetailElementName.Namespace);
                    attr.Value = id;
                    child.Attributes.SetNamedItem(attr);

                    // exception message
                    child.InnerText = e.Message;

                    node.AppendChild(child);
                }

                message = String.Format("{0} : {1}", ComplexExceptionMessage, message);

                throw new SoapException(message,
                                        SoapException.ServerFaultCode,
                                        null, node);
            }
        }