コード例 #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));
            }
        }
コード例 #3
0
        /// <summary>
        /// Set the iFolder Policy
        /// </summary>
        /// <param name="props">The iFolderPolicy Object</param>
        /// <param name="accessID">The Access User ID</param>
        public static void SetPolicy(iFolderPolicy props, string accessID)
        {
            Store store = Store.GetStore();

            Collection c = store.GetCollectionByID(props.iFolderID);

            if (c == null)
            {
                throw new iFolderDoesNotExistException(props.iFolderID);
            }

            // impersonate
            iFolder.Impersonate(c, accessID);

            // NOTE: always unlock the collection so other policy properties
            // can be modified
            if (c.IsLockedByName(lockName))
            {
                c.Unlock(lockName);
            }

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

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

            // to set the value for disable sharing policy for this iFolder
            if (props.SharingStatus >= 0)
            {
                Simias.Policy.Sharing.Set(c, props.SharingStatus);
            }

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

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

            // no syncing (locked)
            // NOTE: re-lock the collection (see the beginning of the method)
            // if a lock was requested
            //if (props.Locked)
            {
                //	c.Lock(lockName);
                c.Disabled = props.Locked;
                c.Commit();
            }
        }