Example #1
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);
        }
Example #2
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);
        }
Example #3
0
        public virtual bool GetSharingPolicy(string iFolderID)
        {
            //return base.GetDisableSharingPolicy ( iFolderID );
            iFolder       ifolder              = base.GetiFolder(iFolderID);
            UserPolicy    userPolicy           = UserPolicy.GetPolicy(ifolder.OwnerID);
            SystemPolicy  systemPolicy         = SystemPolicy.GetPolicy();
            iFolderPolicy ifolderPolicy        = iFolderPolicy.GetPolicy(iFolderID, GetAccessID());
            int           iFolderSharingStatus = ifolderPolicy.SharingStatus;
            int           UserSharingStatus    = userPolicy.SharingStatus;
            int           GroupSharingStatus   = UserPolicy.GetUserGroupSharingPolicy(ifolder.OwnerID);
            int           SystemSharingStatus  = systemPolicy.SharingStatus;

            if (((SystemSharingStatus & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing))
            {
                /// If on system level or user level, enforcement of policy is there, it means the iFolder must not be shared
                if ((SystemSharingStatus & (int)Share.Sharing) == (int)Share.Sharing)
                {
                    return(true);
                }
                return(false);
            }
            else if (((GroupSharingStatus & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing))
            {
                if ((GroupSharingStatus & (int)Share.Sharing) == (int)Share.Sharing)
                {
                    return(true);
                }
                return(false);
            }
            else if (((UserSharingStatus & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing))
            {
                if ((UserSharingStatus & (int)Share.Sharing) == (int)Share.Sharing)
                {
                    return(true);
                }
                return(false);
            }
            else
            {
                if (iFolderSharingStatus != 0)
                {
                    if ((iFolderSharingStatus & (int)Share.Sharing) == (int)Share.Sharing || iFolderSharingStatus == 0)
                    {
                        /// it means, on iFolder Details page, admin had unchecked the box so sharing is enabled now
                        return(true);
                    }
                    if ((iFolderSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing)
                    {
                        /// it means, on iFolder Details page, admin had checked the box so sharing is disabled
                        return(false);
                    }
                }
                else
                {
                    /// no iFolder level policy present , now if current user is not an owner , then check for system level policy
                    /// if current user is owner of the iFolder, then check for user level and then for system level

                    if ((UserSharingStatus & (int)Share.Sharing) == (int)Share.Sharing)
                    {
                        /// it means, on User Details page, admin had unchecked the box so sharing is enabled now
                        return(true);
                    }
                    if ((UserSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing)
                    {
                        /// it means, on User Details page, admin had checked the box so sharing is disabled
                        return(false);
                    }

                    /// check for Group level policy as there was no user level or ifolder level policy applied
                    /// No policy found on iFolder level or User level, no enforcement also, so follow group level
                    if ((GroupSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing)
                    {
                        return(false);
                    }
                    if ((GroupSharingStatus & (int)Share.Sharing) == (int)Share.Sharing)
                    {
                        return(true);
                    }

                    /// check for system level policy as there was no user level or ifolder level policy applied
                    /// No policy found on iFolder level or User level, no enforcement also, so follow system level
                    if ((SystemSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing)
                    {
                        return(false);
                    }
                    if ((SystemSharingStatus & (int)Share.Sharing) == (int)Share.Sharing || SystemSharingStatus == 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }