コード例 #1
0
        /// <summary>
        /// Set the iFolder System Policy
        /// </summary>
        /// <param name="props">The SystemPolicy Object</param>
        public static void SetPolicy(SystemPolicy props)
        {
            Store store = Store.GetStore();

            string domain = store.DefaultDomain;

            // space limit
            if (props.SpaceLimitUser >= -1)
            {
                DiskSpaceQuota.Set(domain, props.SpaceLimitUser);
            }

            // ifolder limit
            iFolderLimit.Set(domain, props.NoiFoldersLimit);

            // sync interval
            if (props.SyncInterval >= 0)
            {
                Simias.Policy.SyncInterval.Set(domain, props.SyncInterval);
            }
            // Added by Ramesh
            //Encryption Status
            Simias.Policy.SecurityState.Create(domain, props.EncryptionStatus);

            // Setting the enumerator value for disabling sharing
            Simias.Policy.Sharing.Create(domain, props.SharingStatus);

            // file size
            if (props.FileSizeLimit >= 0)
            {
                FileSizeFilter.Set(domain, props.FileSizeLimit);
            }

            // file types
            if ((props.FileTypesExcludes != null) || (props.FileTypesIncludes != null))
            {
                FileTypeFilter.Set(domain, SystemPolicy.CombineFileTypes(
                                       props.FileTypesIncludes, props.FileTypesExcludes));
            }
        }
コード例 #2
0
ファイル: UserPolicy.cs プロジェクト: lulzzz/simias
        /// <summary>
        /// Set the User Policy
        /// </summary>
        /// <param name="props">The UserPolicy Object</param>
        public static void SetPolicy(UserPolicy props)
        {
            Store store = Store.GetStore();

            Domain domain = store.GetDomain(store.DefaultDomain);

            Member member = domain.GetMemberByID(props.UserID);

            if (member == null)
            {
                throw new UserDoesNotExistException(props.UserID);
            }

            if (props.LoginEnabled == true)
            {
                domain.SetLoginDisabled(props.UserID, false);
            }
            else
            {
                domain.SetLoginDisabled(props.UserID, true);
            }


// Added by Ramesh
            if (props.EncryptionStatus >= 0)
            {
                Simias.Policy.SecurityState.Create(member, props.EncryptionStatus);
            }

            // to set disable sharing policy value for an user
            if (props.SharingStatus >= 0)
            {
                Simias.Policy.Sharing.Create(member, props.SharingStatus);
            }

            // disk space
            if (props.SpaceLimit >= -1)
            {
                DiskSpaceQuota.Set(member, props.SpaceLimit);
            }


            //limiting no of ifolder per user policy.
            if (props.NoiFoldersLimit >= -2)
            {
                iFolderLimit.Set(member, props.NoiFoldersLimit);
            }


            // file size
            if (props.FileSizeLimit >= 0)
            {
                FileSizeFilter.Set(member, props.FileSizeLimit);
            }

            // sync interval
            if (props.SyncInterval >= 0)
            {
                Simias.Policy.SyncInterval.Set(member, props.SyncInterval);
            }

            // file types
            if ((props.FileTypesExcludes != null) || (props.FileTypesIncludes != null))
            {
                FileTypeFilter.Set(member, SystemPolicy.CombineFileTypes(
                                       props.FileTypesIncludes, props.FileTypesExcludes));
            }
        }