public MapPermissionType GetUserPermissionToFolderByGroup(string fId, string uId)
        {
            GroupController gc     = new GroupController();
            var             user   = _userService.GetUserById(new ObjectId(uId));
            var             folder = _folderManeger.GetMapFolderById(new ObjectId(fId));
            var             groups = folder.Permissions.Groups.Where(x => gc.IsGroupMember(x.Key.ToString(), uId));
            var             pers   = groups.Select(x => x.Value).Distinct();

            if (pers.Contains(MapPermissionType.RW))
            {
                return(MapPermissionType.RW);
            }
            else if (pers.Contains(MapPermissionType.RO))
            {
                return(MapPermissionType.RO);
            }
            return(MapPermissionType.NA);
        }
Example #2
0
        public ActionResult MySharedMaps()
        {
            try
            {
                var      id         = User.Identity.GetUserId();
                ObjectId oId        = new ObjectId(id);
                var      mapsByUser = _mapManager.GetSharedMapsById(oId);

                GroupController gc           = new GroupController();
                var             groups       = gc.GetGroupsByUserId(id);
                var             mapsByGroups = _mapManager.GetAllMapContainsGroupsNotOwned(id, groups);

                var maps = mapsByUser.Union(mapsByGroups, new MapComparer());
                return(PartialView("_MyMapsView", maps));
            }
            catch (Exception)
            {
                return(RedirectToAction("Index", "Home"));
            }
        }