All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pubnub.api.models.consumer.access_manager.v3.PNToken.kt Maven / Gradle / Ivy

Go to download

PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!

There is a newer version: 10.2.0
Show newest version
package com.pubnub.api.models.consumer.access_manager.v3

import com.pubnub.api.models.TokenBitmask

data class PNToken(
    val version: Int = 0,
    val timestamp: Long = 0,
    val ttl: Long = 0,
    val authorizedUUID: String? = null,
    val resources: PNTokenResources,
    val patterns: PNTokenResources,
    val meta: Any? = null
) {

    data class PNTokenResources(
        val channels: Map = emptyMap(),
        val channelGroups: Map = emptyMap(),
        val uuids: Map = emptyMap()
    )

    data class PNResourcePermissions(
        val read: Boolean = false,
        val write: Boolean = false,
        val manage: Boolean = false,
        val delete: Boolean = false,
        val get: Boolean = false,
        val update: Boolean = false,
        val join: Boolean = false
    ) {

        constructor(grant: Int) : this(
            grant and TokenBitmask.READ != 0,
            grant and TokenBitmask.WRITE != 0,
            grant and TokenBitmask.MANAGE != 0,
            grant and TokenBitmask.DELETE != 0,
            grant and TokenBitmask.GET != 0,
            grant and TokenBitmask.UPDATE != 0,
            grant and TokenBitmask.JOIN != 0
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy