Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using DCL.Communities.CommunitiesDataProvider.DTOs;
using DCL.Diagnostics;
using DCL.Multiplayer.Connections.DecentralandUrls;
using DCL.PrivateWorlds;
using DCL.Utilities.Extensions;
using DCL.Web3.Identities;
using DCL.WebRequests;
Expand All @@ -15,7 +16,7 @@

namespace DCL.Communities.CommunitiesDataProvider
{
public class CommunitiesDataProvider
public class CommunitiesDataProvider : ICommunityMembershipChecker
{
public event Action<CreateOrUpdateCommunityResponse.CommunityData> CommunityCreated;
public event Action<string> CommunityUpdated;
Expand Down Expand Up @@ -62,6 +63,12 @@ public async UniTask<GetCommunityResponse> GetCommunityAsync(string communityId,
return response;
}

public async UniTask<bool> IsMemberOfCommunityAsync(string communityId, CancellationToken ct)
{
GetCommunityResponse response = await GetCommunityAsync(communityId, ct);
return response.data.role != CommunityMemberRole.none;
}

public async UniTask<GetUserCommunitiesResponse> GetUserCommunitiesAsync(string name, bool onlyMemberOf, int pageNumber, int elementsPerPage, CancellationToken ct, bool includeRequestsReceivedPerCommunity = false, bool isStreaming = false)
{
var url = $"{communitiesBaseUrl}?search={name}&onlyMemberOf={onlyMemberOf.ToString().ToLower()}&offset={(pageNumber * elementsPerPage) - elementsPerPage}&limit={elementsPerPage}";
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,10 @@ static IMultiPool MultiPoolFactory() =>
IPendingTransferService pendingTransferService = new PendingTransferService(giftingPersistence);
IAvatarEquippedStatusProvider equippedStatusProvider = new AvatarEquippedStatusProvider(selfProfile);
var communitiesDataProvider = new CommunitiesDataProvider(staticContainer.WebRequestsContainer.WebRequestController, bootstrapContainer.DecentralandUrlsSource, identityCache);
var communityMembershipChecker = new CommunityMembershipCheckerAdapter(communitiesDataProvider);
IWorldPermissionsService worldPermissionsService = new WorldPermissionsService(staticContainer.WebRequestsContainer.WebRequestController,
bootstrapContainer.DecentralandUrlsSource,
identityCache,
communityMembershipChecker);
communitiesDataProvider);
IEmoteProvider emoteProvider = new ApplicationParamsEmoteProvider(appArgs,
new EcsEmoteProvider(globalWorld, identityCache), builderDTOsURL.Value);

Expand Down
1 change: 0 additions & 1 deletion Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"GUID:92920c790fc0443e9a7ec2f7d1e5308f",
"GUID:4fd6538c1c56b409fb53fdf0183170ec",
"GUID:c9a2684b0a08c4770a369d035cb74141",
"GUID:f8127c6ac263abf468221dcbccbde182",
"GUID:d0fdd32139c48634e9a421636d17ce04",
"GUID:b3ea857cc09201a4fb44cae9ca69de08",
"GUID:9a1625cbfe83d3842a7b140fc34eabb2",
Expand Down
30 changes: 0 additions & 30 deletions Explorer/Assets/DCL/PrivateWorlds/DCL.PrivateWorlds.asmdef

This file was deleted.

This file was deleted.

10 changes: 8 additions & 2 deletions Explorer/Assets/DCL/RealmNavigation/DCL.RealmNavigation.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@
"GUID:875a5d5129614170bd769ed012c2eb3d",
"GUID:286980af24684da6acc1caa413039811",
"GUID:006c0e0a70294dbba8a4cbcfb77e1f7d",
"GUID:f8127c6ac263abf468221dcbccbde182",
"GUID:7c80dc1d35d179b4eab830deeead3c24"
"GUID:7c80dc1d35d179b4eab830deeead3c24",
"GUID:5ab29fa8ae5769b49ab29e390caca7a4",
"GUID:45f6fff651a0a514f8edfdaf9cce45af",
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:ac3295688c7c22745a96e6ac34718181",
"GUID:e169fa6683c924c7e99a85981a91d953",
"GUID:809870cbfd80a7b46bcf72b178ab210b",
"GUID:702f733b4deb246808c6ce84d93b5c9c"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ public enum WorldAccessResult
}

public interface IWorldAccessGate
{
{
UniTask<WorldAccessResult> CheckAccessAsync(string worldName, string? ownerAddress, CancellationToken ct);
}

public interface ICommunityMembershipChecker
{
UniTask<bool> IsMemberOfCommunityAsync(string communityId, CancellationToken ct);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using Cysharp.Threading.Tasks;
using DCL.Chat;
using DCL.Chat.History;
using DCL.Diagnostics;
using DCL.Multiplayer.Connections.RoomHubs;
using ECS;
using ECS.SceneLifeCycle.Realm;
using DCL.LiveKit.Public;
using LiveKit.Proto;
using LiveKit.Rooms;
using System;
using System.Threading;
Expand Down Expand Up @@ -102,7 +100,7 @@ private async UniTaskVoid RunPermissionCheckAsync(CancellationToken ct)

private async UniTask CheckCurrentWorldAccessAndTeleportIfRevokedAsync(CancellationToken ct)
{
if (ct.IsCancellationRequested ||
if (ct.IsCancellationRequested ||
realmData.RealmType.Value is not RealmKind.World)
return;

Expand All @@ -113,7 +111,7 @@ private async UniTask CheckCurrentWorldAccessAndTeleportIfRevokedAsync(Cancellat

WorldAccessCheckContext context = await worldPermissionsService.CheckWorldAccessAsync(worldName, ct);

if (ct.IsCancellationRequested ||
if (ct.IsCancellationRequested ||
realmData.RealmType.Value is not RealmKind.World)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ public ValidatePasswordResult(bool success, string? errorMessage = null)
public static ValidatePasswordResult Fail(string? errorMessage) => new (false, errorMessage);
}

/// <summary>
/// Abstraction for checking if the current user is a member of a community.
/// Implemented by an adapter that uses CommunitiesDataProvider (avoids DCL.PrivateWorlds referencing DCL.Social).
/// </summary>
public interface ICommunityMembershipChecker
{
/// <summary>
/// Returns true if the current user is a member of the given community (role != none).
/// </summary>
UniTask<bool> IsMemberOfCommunityAsync(string communityId, CancellationToken ct);
}

/// <summary>
/// Service for fetching and checking world access permissions.
/// </summary>
Expand All @@ -95,13 +83,13 @@ public class WorldPermissionsService : IWorldPermissionsService
private readonly IWebRequestController webRequestController;
private readonly IDecentralandUrlsSource urlsSource;
private readonly IWeb3IdentityCache web3IdentityCache;
private readonly ICommunityMembershipChecker? communityMembershipChecker;
private readonly ICommunityMembershipChecker communityMembershipChecker;

public WorldPermissionsService(
IWebRequestController webRequestController,
IDecentralandUrlsSource urlsSource,
IWeb3IdentityCache web3IdentityCache,
ICommunityMembershipChecker? communityMembershipChecker = null)
ICommunityMembershipChecker communityMembershipChecker)
{
this.webRequestController = webRequestController;
this.urlsSource = urlsSource;
Expand Down Expand Up @@ -290,7 +278,7 @@ private async UniTask<bool> CheckAllowListAccessAsync(WorldAccessInfo accessInfo
return true;
}

if (communityMembershipChecker != null && accessInfo.AllowedCommunities.Count > 0)
if (accessInfo.AllowedCommunities.Count > 0)
{
var membershipChecks = new UniTask<bool>[accessInfo.AllowedCommunities.Count];

Expand Down
1 change: 0 additions & 1 deletion Explorer/Assets/DCL/Social/DCL.Social.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"GUID:9b4463c7170cb485aaf17878a8b7281e",
"GUID:2efe6c760f205482eb96395a31bb7036",
"GUID:8ef573751495a4f88822a98a88954a0b",
"GUID:f8127c6ac263abf468221dcbccbde182",
"GUID:1300820cd310d4584b09afde765bdd16",
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:d0ec51c740809fd4680d3ea27279dca7",
Expand Down
Loading