示例#1
0
        /// <summary>
        /// Get the iFolder System Policy
        /// </summary>
        /// <returns>An SystemPolicy Object</returns>
        public static SystemPolicy GetPolicy()
        {
            SystemPolicy props = new SystemPolicy();

            Store store = Store.GetStore();

            string domain = store.DefaultDomain;

            // space limit
            props.SpaceLimitUser = DiskSpaceQuota.GetLimit(domain);

            //ifolder limit
            props.NoiFoldersLimit = iFolderLimit.GetLimit(domain);

            // sync internval
            props.SyncInterval = Simias.Policy.SyncInterval.GetInterval(domain);

            // file size
            props.FileSizeLimit = FileSizeFilter.GetLimit(domain);

            props.EncryptionStatus = Simias.Policy.SecurityState.GetStatus(domain);

            // Disable sharing policy
            props.SharingStatus = Simias.Policy.Sharing.GetStatus(domain);

            // file types
            SystemPolicy.SplitFileTypes(FileTypeFilter.GetPatterns(domain),
                                        out props.FileTypesIncludes, out props.FileTypesExcludes);

            return(props);
        }
示例#2
0
        /// <summary>
        /// Get the User Policy
        /// </summary>
        /// <param name="userID">The User ID</param>
        /// <returns>The UserPolicy Object</returns>
        public static UserPolicy GetPolicy(string userID, string AdminId)
        {
            UserPolicy props = new UserPolicy();

            props.UserID = userID;

            Store store = Store.GetStore();

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

            Member member = domain.GetMemberByID(userID);

            if (member == null)
            {
                throw new UserDoesNotExistException(userID);
            }

            Access.Rights rights = (member != null) ? member.Rights : Access.Rights.Deny;

            props.isAdmin = (rights == Access.Rights.Admin);

            props.LoginEnabled = !(domain.GetLoginpolicy(userID));

            // disk space
            DiskSpaceQuota quota = DiskSpaceQuota.Get(member);

            props.SpaceLimitEffective = quota.Limit;
            //props.SpaceUsed = quota.UsedSpace;
            props.SpaceUsed = Simias.Server.Catalog.GetUsedSpaceOfUserID(userID);
            //props.SpaceAvailable = quota.AvailableSpace;

            props.SpaceLimit       = DiskSpaceQuota.GetLimit(member);
            props.SpaceAvailable   = props.SpaceLimitEffective - props.SpaceUsed;
            props.EncryptionStatus = Simias.Policy.SecurityState.GetStatus(member);

            // To return disable sharing value for an user
            props.SharingStatus = Simias.Policy.Sharing.GetStatus(member);

            // file size
            props.FileSizeLimit          = FileSizeFilter.GetLimit(member);
            props.FileSizeLimitEffective = FileSizeFilter.Get(member).Limit;

            //No of ifolders limit
            props.NoiFoldersLimit = iFolderLimit.Get(member).Limit;

            // sync interval
            props.SyncInterval          = Simias.Policy.SyncInterval.GetInterval(member);
            props.SyncIntervalEffective = Simias.Policy.SyncInterval.Get(member).Interval;

            // file types
            SystemPolicy.SplitFileTypes(FileTypeFilter.GetPatterns(member),
                                        out props.FileTypesIncludes, out props.FileTypesExcludes);

            // file types effective
            SystemPolicy.SplitFileTypes(FileTypeFilter.Get(member, false).FilterUserList,
                                        out props.FileTypesIncludesEffective, out props.FileTypesExcludesEffective);
            props.AdminGroupRights = iFolderUser.GetAdminRights(AdminId, userID);
            return(props);
        }