Skip to content

Commit 3e5d15c

Browse files
authored
Deprecated GrantToken with spaces and users (#354)
* Deprecated GrantToken with spaces and users
1 parent a3c2a00 commit 3e5d15c

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/PubNub.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,14 @@ interface PubNub : EventEmitter, StatusEmitter {
277277
* Each type of resource have different set of permissions. To know what's possible for each of them
278278
* check ChannelGrant, ChannelGroupGrant and UUIDGrant.
279279
*/
280+
@Deprecated(
281+
replaceWith =
282+
ReplaceWith(
283+
"grantToken(ttl)"
284+
),
285+
level = DeprecationLevel.WARNING,
286+
message = "Use grantToken(ttl) instead",
287+
)
280288
fun grantToken(): GrantTokenBuilder
281289

282290
/**

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/access/builder/GrantTokenBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ public interface GrantTokenBuilder extends Endpoint<PNGrantTokenResult> {
3030

3131
GrantTokenObjectsBuilder authorizedUUID(String authorizedUUID);
3232

33+
@Deprecated
3334
GrantTokenEntitiesBuilder authorizedUserId(UserId userId);
3435

36+
@Deprecated
3537
GrantTokenEntitiesBuilder spacesPermissions(List<SpacePermissions> spacesPermissions);
3638

39+
@Deprecated
3740
GrantTokenEntitiesBuilder usersPermissions(List<UserPermissions> usersPermissions);
3841
}

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/access/builder/GrantTokenEntitiesBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010

1111
public interface GrantTokenEntitiesBuilder extends Endpoint<PNGrantTokenResult> {
1212

13+
@Deprecated
1314
GrantTokenEntitiesBuilder meta(Object meta);
1415

16+
@Deprecated
1517
GrantTokenEntitiesBuilder spacesPermissions(List<SpacePermissions> spacesPermissions);
1618

19+
@Deprecated
1720
GrantTokenEntitiesBuilder usersPermissions(List<UserPermissions> usersPermissions);
1821

22+
@Deprecated
1923
GrantTokenEntitiesBuilder authorizedUserId(UserId userId);
20-
2124
}

pubnub-gson/pubnub-gson-impl/src/integrationTest/java/com/pubnub/api/integration/pam/GrantTokenIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ public void happyPath() throws PubNubException {
6363

6464
//when
6565
final PNGrantTokenResult grantTokenResponse = pubNubUnderTest
66-
.grantToken()
67-
.ttl(expectedTTL)
66+
.grantToken(expectedTTL)
6867
.channels(Arrays.asList(ChannelGrant.name(expectedChannelResourceName).delete(),
6968
ChannelGrant.pattern(expectedChannelPattern).write()))
7069
.channelGroups(Arrays.asList(ChannelGroupGrant.id(expectedChannelGroupResourceId).read(),

pubnub-kotlin/pubnub-kotlin-api/src/jvmMain/kotlin/com/pubnub/api/PubNub.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,13 @@ actual interface PubNub : StatusEmitter, EventEmitter {
10901090
* @param spacesPermissions List of all space grants
10911091
* @param usersPermissions List of all userId grants
10921092
*/
1093+
@Deprecated(
1094+
level = DeprecationLevel.WARNING,
1095+
message = "This function is deprecated. Use the new grantToken(ttl, userId, meta, authorizedUUID, channels, channelGroups, uuids)",
1096+
replaceWith = ReplaceWith(
1097+
"grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)"
1098+
)
1099+
)
10931100
fun grantToken(
10941101
ttl: Int,
10951102
meta: Any? = null,

0 commit comments

Comments
 (0)