Skip to content

Commit

Permalink
Add Users/Spaces support to PCL versions (#156)
Browse files Browse the repository at this point in the history
* Add Users/Spaces support to PCL versions
  • Loading branch information
budgetpreneur authored Sep 6, 2022
1 parent f71e959 commit eaeb6bb
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 18 deletions.
19 changes: 12 additions & 7 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: c-sharp
version: "6.9.0"
version: "6.10.0"
schema: 1
scm: github.com/pubnub/c-sharp
changelog:
- date: 2022-09-06
version: v6.10.0
changes:
- type: bug
text: "Add Users/Spaces support to PCL versions."
- date: 2022-08-22
version: v6.9.0
changes:
Expand Down Expand Up @@ -675,7 +680,7 @@ features:
- QUERY-PARAM
supported-platforms:
-
version: Pubnub 'C#' 6.9.0
version: Pubnub 'C#' 6.10.0
platforms:
- Windows 10 and up
- Windows Server 2008 and up
Expand All @@ -685,7 +690,7 @@ supported-platforms:
- .Net Framework 4.5
- .Net Framework 4.6.1+
-
version: PubnubPCL 'C#' 6.9.0
version: PubnubPCL 'C#' 6.10.0
platforms:
- Xamarin.Android
- Xamarin.iOS
Expand All @@ -705,7 +710,7 @@ supported-platforms:
- .Net Core
- .Net 6.0
-
version: PubnubUWP 'C#' 6.9.0
version: PubnubUWP 'C#' 6.10.0
platforms:
- Windows Phone 10
- Universal Windows Apps
Expand All @@ -729,7 +734,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: Pubnub
location: https://github.com/pubnub/c-sharp/releases/tag/v6.9.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.10.0.0
requires:
-
name: ".Net"
Expand Down Expand Up @@ -1012,7 +1017,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubNubPCL
location: https://github.com/pubnub/c-sharp/releases/tag/v6.9.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.10.0.0
requires:
-
name: ".Net Core"
Expand Down Expand Up @@ -1371,7 +1376,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubnubUWP
location: https://github.com/pubnub/c-sharp/releases/tag/v6.9.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.10.0.0
requires:
-
name: "Universal Windows Platform Development"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v6.10.0 - September 06 2022
-----------------------------
- Fixed: add Users/Spaces support to PCL versions.

v6.9.0 - August 22 2022
-----------------------------
- Fixed: fix Timer reference conflict in net6.0.
Expand Down
30 changes: 28 additions & 2 deletions src/Api/PubnubApi/EndPoint/Access/GrantTokenOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,18 @@ internal async Task<PNResult<PNAccessManagerTokenResult>> GrantAccess()

Dictionary<string, int> chPatternBitmaskPermCollection = null;
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubPatterns.Channels, atleastOnePermission, out chPatternBitmaskPermCollection);
Dictionary<string, int> spBitmaskPermCollection = null;
Dictionary<string, int> spPatternBitmaskPermCollection = null;
if (pubnubResources.Channels.Count == 0 && pubnubPatterns.Channels.Count == 0)
{
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubResources.Spaces, atleastOnePermission, out spBitmaskPermCollection);
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubPatterns.Spaces, atleastOnePermission, out spPatternBitmaskPermCollection);
}
else
{
spBitmaskPermCollection = new Dictionary<string, int>();
spPatternBitmaskPermCollection = new Dictionary<string, int>();
}

Dictionary<string, int> cgBitmaskPermCollection = null;
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubResources.ChannelGroups, atleastOnePermission, out cgBitmaskPermCollection);
Expand All @@ -389,6 +401,20 @@ internal async Task<PNResult<PNAccessManagerTokenResult>> GrantAccess()

Dictionary<string, int> uuidPatternBitmaskPermCollection = null;
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubPatterns.Uuids, atleastOnePermission, out uuidPatternBitmaskPermCollection);

Dictionary<string, int> userBitmaskPermCollection = null;
Dictionary<string, int> userPatternBitmaskPermCollection = null;
if (pubnubResources.Uuids.Count == 0 && pubnubPatterns.Uuids.Count == 0)
{
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubResources.Users, atleastOnePermission, out userBitmaskPermCollection);
atleastOnePermission = FillPermissionMappingWithMaskValues(this.pubnubPatterns.Users, atleastOnePermission, out userPatternBitmaskPermCollection);
}
else
{
userBitmaskPermCollection = new Dictionary<string, int>();
userPatternBitmaskPermCollection = new Dictionary<string, int>();

}

if (!atleastOnePermission)
{
Expand All @@ -399,8 +425,8 @@ internal async Task<PNResult<PNAccessManagerTokenResult>> GrantAccess()
resourcesCollection.Add("channels", chBitmaskPermCollection);
resourcesCollection.Add("groups", cgBitmaskPermCollection);
resourcesCollection.Add("uuids", uuidBitmaskPermCollection);
resourcesCollection.Add("users", new Dictionary<string, int>()); //Empty object for users for json structure
resourcesCollection.Add("spaces", new Dictionary<string, int>()); //Empty object for spaces for json structure
resourcesCollection.Add("users", userBitmaskPermCollection);
resourcesCollection.Add("spaces", spBitmaskPermCollection);

Dictionary<string, object> patternsCollection = new Dictionary<string, object>();
patternsCollection.Add("channels", chPatternBitmaskPermCollection);
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[assembly: AssemblyProduct("Pubnub C# SDK")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("6.9.0.0")]
[assembly: AssemblyFileVersion("6.9.0.0")]
[assembly: AssemblyVersion("6.10.0.0")]
[assembly: AssemblyFileVersion("6.10.0.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/PubnubApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

<PropertyGroup>
<PackageId>Pubnub</PackageId>
<PackageVersion>6.9.0.0</PackageVersion>
<PackageVersion>6.10.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Fix Timer reference conflict in net6.0.</PackageReleaseNotes>
<PackageReleaseNotes>Add Users/Spaces support to PCL versions.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApiPCL/PubnubApiPCL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

<PropertyGroup>
<PackageId>PubnubPCL</PackageId>
<PackageVersion>6.9.0.0</PackageVersion>
<PackageVersion>6.10.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Fix Timer reference conflict in net6.0.</PackageReleaseNotes>
<PackageReleaseNotes>Add Users/Spaces support to PCL versions.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApiUWP/PubnubApiUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

<PropertyGroup>
<PackageId>PubnubUWP</PackageId>
<PackageVersion>6.9.0.0</PackageVersion>
<PackageVersion>6.10.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Fix Timer reference conflict in net6.0.</PackageReleaseNotes>
<PackageReleaseNotes>Add Users/Spaces support to PCL versions.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
7 changes: 6 additions & 1 deletion src/UnitTests/PubnubApi.Tests/WhenGrantIsRequested.cs
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ public static async Task ThenWithAsyncGrantTokenShouldReturnSuccess()

#if NET40
#else
PNResult<PNAccessManagerTokenResult> result = await pubnub.GrantToken()
PNResult<PNAccessManagerTokenResult> grantResponse = await pubnub.GrantToken()
.Resources(new PNTokenResources()
{
Spaces = new Dictionary<string, PNTokenAuthValues>() {
Expand All @@ -1002,7 +1002,12 @@ public static async Task ThenWithAsyncGrantTokenShouldReturnSuccess()
)
.TTL(10)
.ExecuteAsync();
if (grantResponse.Result != null && !grantResponse.Status.Error)
{
receivedGrantMessage = true;
}
#endif
Assert.IsTrue(receivedGrantMessage, "WhenGrantIsRequested -> ThenWithAsyncGrantTokenShouldReturnSuccess failed.");

}

Expand Down

0 comments on commit eaeb6bb

Please sign in to comment.