Exemplo n.º 1
0
        public OperationResultWithData <string> GetDownloadAsZipLink(string scoId, string breezeToken)
        {
            if (string.IsNullOrWhiteSpace(scoId))
            {
                throw new ArgumentException("Non-empty value expected", nameof(scoId));
            }
            if (string.IsNullOrWhiteSpace(breezeToken))
            {
                throw new ArgumentException("Non-empty value expected", nameof(breezeToken));
            }

            try
            {
                string url = _contentService.GetDownloadAsZipLink(scoId, breezeToken);

                return(OperationResultWithData <string> .Success(url));
            }
            catch (WarningMessageException ex)
            {
                return(OperationResultWithData <string> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat(ex, "AccessFile exception. sco-id:{0}.", scoId);
                return(OperationResultWithData <string> .Error(ex.Message + ex.StackTrace));
            }
        }
Exemplo n.º 2
0
        //public async Task<OperationResultWithData<IEnumerable<TDto>>> GetShortcuts(IEnumerable<ScoShortcutType> typesToReturn)
        //{
        //    try
        //    {
        //        return OperationResultWithData<IEnumerable<TDto>>.Success(_contentService.GetShortcuts(typesToReturn).Select(x => _mapper.Map(x)));
        //    }
        //    catch (AdobeConnectException ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetShortcuts", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //    catch (Exception ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetShortcuts", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //}

        //[HttpGet]
        //[Route("my-content")]
        //public async Task<OperationResultWithData<IEnumerable<TDto>>> GetMyContent()
        //{
        //    try
        //    {
        //        return OperationResultWithData<IEnumerable<TDto>>.Success(_contentService.GetMyContent().Select(x => _mapper.Map(x)));
        //    }
        //    catch (AdobeConnectException ex)
        //    {
        //        if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
        //        {
        //            return OperationResultWithData<IEnumerable<TDto>>.Error("You do not have permission to access this item.");
        //        }

        //        string errorMessage = GetOutputErrorMessage("GetMyContent", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //    catch (Exception ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetMyContent", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //}

        //public async Task<OperationResultWithData<IEnumerable<TDto>>> GetUserContent(string userLogin)
        //{
        //    if (string.IsNullOrWhiteSpace(userLogin))
        //        throw new ArgumentException("Non-empty value expected", nameof(userLogin));

        //    try
        //    {
        //        return OperationResultWithData<IEnumerable<TDto>>.Success(_contentService.GetUserContent(userLogin).Select(x => _mapper.Map(x)));
        //    }
        //    catch (AdobeConnectException ex)
        //    {
        //        if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
        //        {
        //            return OperationResultWithData<IEnumerable<TDto>>.Error("You do not have permission to access this item.");
        //        }

        //        string errorMessage = GetOutputErrorMessage("GetMyContent", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //    catch (Exception ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetMyContent", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //}

        //public async Task<OperationResultWithData<IEnumerable<TDto>>> GetSharedContent()
        //{
        //    try
        //    {
        //        return OperationResultWithData<IEnumerable<TDto>>.Success(_contentService.GetSharedContent().Select(x => _mapper.Map(x)));
        //    }
        //    catch (AdobeConnectException ex)
        //    {
        //        if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
        //        {
        //            return OperationResultWithData<IEnumerable<TDto>>.Error("You do not have permission to access this item.");
        //        }

        //        string errorMessage = GetOutputErrorMessage("GetSharedContent", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //    catch (Exception ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetSharedContent", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //}

        public async Task <OperationResultWithData <IEnumerable <TDto> > > GetFolderContent(string folderScoId, IDtoProcessor <TDto> processor)
        {
            if (string.IsNullOrWhiteSpace(folderScoId))
            {
                throw new ArgumentException("Non-empty value expected", nameof(folderScoId));
            }
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            try
            {
                var result = _contentService.GetFolderContent(folderScoId)
                             .Select(x => _mapper.Map(x))
                             .Select(y => processor.Process(y));

                return(OperationResultWithData <IEnumerable <TDto> > .Success(result));
            }
            catch (AdobeConnectException ex)
            {
                if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
                {
                    return(OperationResultWithData <IEnumerable <TDto> > .Error("You do not have permission to access this item."));
                }

                string errorMessage = GetOutputErrorMessage("FolderContent", ex);
                return(OperationResultWithData <IEnumerable <TDto> > .Error(errorMessage));
            }
            catch (Exception ex)
            {
                string errorMessage = GetOutputErrorMessage("FolderContent", ex);
                return(OperationResultWithData <IEnumerable <TDto> > .Error(errorMessage));
            }
        }
Exemplo n.º 3
0
        //public async Task<OperationResultWithData<IEnumerable<TDto>>> GetMyMeetings()
        //{
        //    try
        //    {
        //        return OperationResultWithData<IEnumerable<TDto>>.Success(_meetingService.GetUserMeetings().Select(x => _mapper.Map(x)));
        //    }
        //    catch (AdobeConnectException ex)
        //    {
        //        if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
        //        {
        //            return OperationResultWithData<IEnumerable<TDto>>.Error("You do not have permission to access this item.");
        //        }

        //        string errorMessage = GetOutputErrorMessage("GetMyMeetings", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //    catch (Exception ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetMyMeetings", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //}

        //public async Task<OperationResultWithData<IEnumerable<TDto>>> GetSharedMeetings()
        //{
        //    try
        //    {
        //        return OperationResultWithData<IEnumerable<TDto>>.Success(_meetingService.GetSharedMeetings().Select(x => _mapper.Map(x)));
        //    }
        //    catch (AdobeConnectException ex)
        //    {
        //        if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
        //        {
        //            return OperationResultWithData<IEnumerable<TDto>>.Error("You do not have permission to access this item.");
        //        }

        //        string errorMessage = GetOutputErrorMessage("GetSharedMeetings", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //    catch (Exception ex)
        //    {
        //        string errorMessage = GetOutputErrorMessage("GetSharedMeetings", ex);
        //        return OperationResultWithData<IEnumerable<TDto>>.Error(errorMessage);
        //    }
        //}

        public async Task <OperationResultWithData <IEnumerable <TDto> > > FolderContent(string folderScoId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(folderScoId))
                {
                    throw new ArgumentException("folderScoId can't be empty", nameof(folderScoId));
                }

                return(OperationResultWithData <IEnumerable <TDto> > .Success(_meetingService.GetFolderMeetings(folderScoId).Select(x => _mapper.Map(x))));
            }
            catch (AdobeConnectException ex)
            {
                if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
                {
                    return(OperationResultWithData <IEnumerable <TDto> > .Error("You do not have permission to access this item."));
                }

                string errorMessage = GetOutputErrorMessage("FolderContent", ex);
                return(OperationResultWithData <IEnumerable <TDto> > .Error(errorMessage));
            }
            catch (Exception ex)
            {
                string errorMessage = GetOutputErrorMessage("FolderContent", ex);
                return(OperationResultWithData <IEnumerable <TDto> > .Error(errorMessage));
            }
        }
Exemplo n.º 4
0
        public OperationResultWithData <FolderDto> CreateFolder(FolderDto dto)
        {
            if (dto == null)
            {
                throw new ArgumentNullException(nameof(dto));
            }

            try
            {
                // TODO: validation!! via FluentValidation
                //if (string.IsNullOrWhiteSpace(dto.FolderId))
                //    throw new ArgumentException("folderScoId can't be empty");

                ScoInfoResult updatedSco =
                    _acProxy.CreateSco(
                        new FolderUpdateItem
                {
                    Name        = dto.Name,
                    Description = dto.Description,
                    FolderId    = dto.FolderId,
                    Type        = ScoType.folder,
                });

                if (!updatedSco.Success)
                {
                    _logger.Error(updatedSco.Status.GetErrorInfo());
                    return(OperationResultWithData <FolderDto> .Error(updatedSco.Status.GetErrorInfo()));
                }

                dto.ScoId = updatedSco.ScoInfo.ScoId;
                return(OperationResultWithData <FolderDto> .Success(dto));
            }
            catch (AdobeConnectException ex)
            {
                if (ex.Status.Code == StatusCodes.no_access && ex.Status.SubCode == StatusSubCodes.denied)
                {
                    return(OperationResultWithData <FolderDto> .Error("You do not have permission to access this item."));
                }

                string errorMessage = GetOutputErrorMessage("CreateFolder", ex);
                return(OperationResultWithData <FolderDto> .Error(errorMessage));
            }
            catch (Exception ex)
            {
                string errorMessage = GetOutputErrorMessage("CreateFolder", ex);
                return(OperationResultWithData <FolderDto> .Error(errorMessage));
            }
        }
Exemplo n.º 5
0
        public virtual async Task <OperationResultWithData <List <LmsUserDTO> > > SetDefaultRolesForNonParticipants([FromBody] MeetingRequestDto request)
        {
            try
            {
                var param        = Session.LtiSession.LtiParam;
                var updatedUsers = await usersSetup.SetDefaultRolesForNonParticipants(
                    LmsCompany,
                    GetAdminProvider(),
                    param,
                    request.MeetingId);

                return(OperationResultWithData <List <LmsUserDTO> > .Success(updatedUsers.Item2, updatedUsers.Item1));
            }
            catch (Exception ex)
            {
                string errorMessage = GetOutputErrorMessage("SetDefaultRolesForNonParticipants", ex);
                return(OperationResultWithData <List <LmsUserDTO> > .Error(errorMessage));
            }
        }