User
class User extends Base (View source)
User management client for the rokka.io service.
Constants
DEFAULT_API_BASE_URL |
|
protected DEFAULT_API_VERSION |
|
protected API_KEY_HEADER |
|
protected API_AUTHORIZATION_HEADER |
|
protected API_VERSION_HEADER |
|
USERS_RESOURCE |
|
USER_RESOURCE |
|
USER_API_KEYS_RESOURCE |
|
ORGANIZATION_RESOURCE |
|
ORGANIZATION_OPTION_PROTECT_DYNAMIC_STACK |
|
Properties
protected ClientInterface | $client | Client to access Rokka. |
from Base |
protected string|null | $defaultOrganization | Default organization. |
from Base |
Methods
Constructor.
Get the API Token Payload (unverified).
Returns for how many seconds a token is valid for.
Call the API rokka endpoint.
Return the organization or the default if empty.
Gets the payload of an API JWT Token (not validated against the signature).
Create a user.
Get current userID.
Add an Api Key to the current user.
Gets info about the currently used Api Key.
Deletes an Api Key for the current user.
Get current user.
Gets a new API JWT Token with an $apiKey.
Create an organization.
Create an organization.
Return an organization.
Create a membership.
Create a user and membership associated to this organization.
Get the membership metadata for the given organization and user's ID.
Deletes a membership for the given organization and user's ID.
List the membership metadata for the given organization.
Details
__construct(ClientInterface $client, string|null $defaultOrganization, string|null $apiKey, string|null $apiToken = null)
Constructor.
in
Base at line 74
void
setCredentials(string|null $key)
Set the credentials.
in
Base at line 88
void
setToken(string|null $token)
Set the API Token.
in
Base at line 98
string|null
getToken()
Get the API Token.
in
Base at line 108
array|null
getTokenPayload(string|null $token = null)
Get the API Token Payload (unverified).
in
Base at line 129
int
getTokenIsValidFor(string|null $token = null)
Returns for how many seconds a token is valid for.
Doesn't check for other validity (like ip restrictions)
Returns -1 if there's no token
in
Base at line 155
protected ResponseInterface
call(string $method, string $path, array $options = [], bool $needsCredentials = true, array $credentials = [])
Call the API rokka endpoint.
in
Base at line 181
protected string
getOrganizationName(string|null $organization = null)
Return the organization or the default if empty.
in
Base at line 194
protected array|null
getUnvalidatedPayload(string $token)
Gets the payload of an API JWT Token (not validated against the signature).
User
createUser(string $email)
Create a user.
string
getCurrentUserId()
Get current userID.
UserApiKey
addUserApiKey(string $comment = null)
Add an Api Key to the current user.
UserApiKey
getCurrentUserApiKey()
Gets info about the currently used Api Key.
bool
deleteUserApiKey(string $id)
Deletes an Api Key for the current user.
User
getCurrentUser()
Get current user.
UserApiToken
getNewToken(string|null $apiKey = null, array $parameters = [])
Gets a new API JWT Token with an $apiKey.
Organization
createOrganization(string $name, string $billingMail, string $displayName = '')
Create an organization.
Organization
setOrganizationOption(string $organization, string $name, string $value)
Create an organization.
Organization
getOrganization(string $organization = '')
Return an organization.
Membership
createMembership(string $userId, string|array $roles = [Membership::ROLE_READ], string $organization = '')
Create a membership.
Membership
createUserAndMembership(string|array $roles = [Membership::ROLE_READ], string $organization = '')
Create a user and membership associated to this organization.
Membership
getMembership(string $userId, string $organization = '')
Get the membership metadata for the given organization and user's ID.
bool
deleteMembership(string $userId, string $organization = '')
Deletes a membership for the given organization and user's ID.
Membership[]
listMemberships(string $organization = '')
List the membership metadata for the given organization.