Пример #1
0
        public ActionResult Create(Guid groupId)
        {
            var currentMember = _intranetMemberService.GetCurrentMember();

            if (!_groupMemberService.IsGroupMember(groupId, currentMember))
            {
                return(new EmptyResult());
            }

            var activityType = _groupFeedContentContentService.GetCreateActivityType(CurrentPage);
            var viewModel    = GetCreateViewModel(activityType, groupId);

            return(PartialView(CreateViewPath, viewModel));
        }
Пример #2
0
        protected override IEnumerable <EventBase> GetComingEvents(DateTime endDate)
        {
            var currentMember = _intranetMemberService.GetCurrentMember();
            var events        = _eventsService.GetComingEvents(endDate);

            bool IsNotGroupEventOrUserInGroup(Event @event) =>
            [email protected] ||
            _groupMemberService.IsGroupMember(@event.GroupId.Value, currentMember.Id);

            return(events.Where(IsNotGroupEventOrUserInGroup));
        }
Пример #3
0
        protected virtual GroupInfoViewModel GetInfoViewModel(Guid groupId)
        {
            var group = _groupService.Get(groupId);

            var groupInfo     = group.Map <GroupInfoViewModel>();
            var currentMember = _memberService.GetCurrentMember();

            groupInfo.IsMember       = _groupMemberService.IsGroupMember(group.Id, currentMember.Id);
            groupInfo.CanUnsubscribe = group.CreatorId != currentMember.Id;

            groupInfo.Creator           = _memberService.Get(group.CreatorId).Map <MemberViewModel>();
            groupInfo.MembersCount      = _groupMemberService.GetMembersCount(group.Id);
            groupInfo.CreatorProfileUrl = _profileLinkProvider.GetProfileLink(group.CreatorId);

            if (group.ImageId.HasValue)
            {
                groupInfo.GroupImageUrl = _imageHelper.GetImageWithPreset(Umbraco.TypedMedia(group.ImageId.Value).Url, UmbracoAliases.ImagePresets.GroupImageThumbnail);
            }

            return(groupInfo);
        }
        private bool HasPermission(Guid?groupId)
        {
            var hasPermission = _permissionsService.Check(PermissionType, PermissionActionEnum.Create);

            if (groupId.HasValue)
            {
                hasPermission = hasPermission &&
                                _groupMemberService.IsGroupMember(groupId.Value, _memberService.GetCurrentMemberId());
            }

            return(hasPermission);
        }
Пример #5
0
        private GroupViewModel MapGroupViewModel(GroupModel group, Guid currentMemberId)
        {
            var groupModel = group.Map <GroupViewModel>();

            groupModel.IsMember     = _groupMemberService.IsGroupMember(groupModel.Id, currentMemberId);
            groupModel.MembersCount = _groupMemberService.GetMembersCount(group.Id);
            groupModel.Creator      = _memberService.Get(group.CreatorId).ToViewModel();
            groupModel.GroupUrl     = _groupLinkProvider.GetGroupRoomLink(group.Id);
            if (groupModel.HasImage)
            {
                groupModel.GroupImageUrl = _imageHelper.GetImageWithPreset(_mediaModelService.Get(group.ImageId.Value).Url, UmbracoAliases.ImagePresets.GroupImageThumbnail);
            }

            return(groupModel);
        }
Пример #6
0
 public bool CanUpload(Guid groupId)
 {
     return(_groupMemberService.IsGroupMember(groupId, _intranetMemberService.GetCurrentMemberId()));
 }