Ejemplo n.º 1
0
        public dtoDisplayItemRepository(BaseCommunityFile file, CoreModuleRepository oPermission, int CurrentUserID, bool isAvailableForAll)
        {
            AvailableForAll = isAvailableForAll;
            File            = file;
            Permission      = new RepositoryItemPermission();

            bool ItemOwner = false;

            if (file.Owner != null)
            {
                ItemOwner = (file.Owner.Id == CurrentUserID);
            }
            bool isMultimedia = (file.isFile && (file.RepositoryItemType != Repository.RepositoryItemType.FileStandard && file.RepositoryItemType != Repository.RepositoryItemType.None));

            if (file.isFile)
            {
                Permission.Play     = (oPermission.Administration || oPermission.DownLoad) && isMultimedia;
                Permission.Download = oPermission.Administration || (file.IsDownloadable && oPermission.DownLoad);
                Permission.ViewAdvancedStatistics = isMultimedia && (oPermission.Administration || oPermission.Edit || (oPermission.UploadFile && ItemOwner));
                Permission.ViewBaseStatistics     = isMultimedia && !(oPermission.Administration || oPermission.Edit || (oPermission.UploadFile && ItemOwner));
                Permission.EditSettings           = isMultimedia && (oPermission.Administration || oPermission.Edit || (oPermission.UploadFile && ItemOwner));
            }
            else
            {
                Permission.Download = false;
                Permission.Link     = false;
                Permission.Play     = false;
                Permission.ViewAdvancedStatistics = false;
                Permission.ViewBaseStatistics     = false;
                Permission.EditSettings           = false;
            }
            if ((file != null))
            {
                DisplayName = file.DisplayName;
            }
            Permission.ViewPermission = oPermission.Administration || oPermission.Edit || (oPermission.UploadFile && ItemOwner);
            Permission.Delete         = oPermission.Administration || oPermission.Edit || (oPermission.DeleteMyFile && ItemOwner);
            Permission.UnDelete       = false;
            Permission.VirtualDelete  = false;
            Permission.Edit           = oPermission.Administration || oPermission.Edit || (oPermission.UploadFile && ItemOwner);
            Permission.EditPermission = oPermission.Administration || oPermission.Edit || (oPermission.UploadFile && ItemOwner);
        }
Ejemplo n.º 2
0
 public dtoDisplayItemRepository()
 {
     Permission = new RepositoryItemPermission();
 }