-
Notifications
You must be signed in to change notification settings - Fork 7
Methods ~ database queries
Definition: /resources/core/database.php
- __construct()
- createResource($scimType, $type)
- deleteResource($resourceID)
- listResources($scimType, $type, $options, $countAll=false)
- addResourceAttribute($resourceID, $attribute, $value)
- getResourceAttributes($resourceID)
- deleteResourceAttributes($resourceID)
- addResourceSchema($resourceID, $value)
- getResourceSchemas($resourceID)
- deleteResourceSchema($resourceID, $schema)
- deleteResourceSchemas($resourceID)
- userExists($userNameOrID, $scimType)
- getUserID($username, $scimType)
- groupExists($groupNameOrID, $scimType)
- getGroupID($group, $scimType)
- addGroupMember($groupID, $userID)
- getGroupMembers($groupID)
- getGroupMemberships($userID)
- deleteGroupMembership($groupID, $userID)
- deleteAllGroupMembership($groupID)
- updateTimestamp($resourceID)
- getMetadata($resourceID)
- gen_uuid()
Description: This method initiates $conn object which is used by the class for database operations.
Description: This method creates a new entry for the resource inside the resources
table and returns the universally unique identifier (UUID) of the resource.
Parameters:
- $scimType
- what is the SCIM version of the resource
- possible values:
"1.1"
(for SCIM 1.1) or"2.0"
(for SCIM 2.0)
- $type
- what is the type of the resource
- possible values:
0
(for Users) or1
(for Groups)
Returns: string
Description: This method receives the UUID of the resource and then deletes all entries related to it from the database.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
Returns: null
Description: This method returns a list of resources based on the parameters passed when called.
Parameters:
- $scimType
- what is the SCIM version of the resource
- possible values:
"1.1"
(for SCIM 1.1) or"2.0"
(for SCIM 2.0)
- $type
- what is the type of the resource
- possible values:
0
(for Users) or1
(for Groups)
- $options
- an array containing the SCIM options used for listing the resources
- usually, this parameter takes the value from
$_GET
- $countAll=false
- if this parameter is passed with true, instead of returning an array of resources, the function will return the total result of resources as integer, useful when returning the totalResults
Returns: array
if $countAll is false, otherwise integer
Description: This method add an attribute for a resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
- $attribute
- the name of the attribute (eg.
"displayName"
)
- the name of the attribute (eg.
- $value
- the value of the attribute (eg.
"Test User"
)
- the value of the attribute (eg.
Returns: null
Description: This method retrieves all the attributes for a resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
Returns: array
Description: This method deletes a specific attribute for a specific resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
- $attribute
- the name of the attribute (eg.
"displayName"
)
- the name of the attribute (eg.
Returns: null
Description: This method deletes all attributes for a specific resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
Returns: null
Description: This method add a schema for a resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
- $value
- the value of the schema (eg.
"urn:scim:schemas:custom:schema"
)
- the value of the schema (eg.
Returns: null
Description: This method retrieves all the schemas for a resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
Returns: array
Description: This method deletes a specific schema for a specific resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
- $schema
- the value of the schema (eg.
"urn:scim:schemas:custom:schema"
)
- the value of the schema (eg.
Returns: null
Description: This method deletes all schemas for a specific resource.
Parameters:
- $resourceID
- the UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- the UUID of the resource (eg.
Returns: null
Description: This method checks if a user exists in the database based on the user's username or UUID.
Parameters:
- $userNameOrID
- user's username (eg.
"[email protected]"
) or UUID (eg."69abb139-ded6-4703-bda7-62e82210a048"
)
- user's username (eg.
- $scimType
- what is the SCIM version of the resource
- possible values:
"1.1"
(for SCIM 1.1) or"2.0"
(for SCIM 2.0)
Returns: bool
Description: This method returns the user's UUID based on his username.
Parameters:
- $username
- user's username (eg.
"[email protected]"
)
- user's username (eg.
- $scimType
- what is the SCIM version of the resource
- possible values:
"1.1"
(for SCIM 1.1) or"2.0"
(for SCIM 2.0)
Returns: string
Description: This method checks if a group exists based on it's display name or UUID.
Parameters:
- $groupNameOrID
- group's display name (eg.
"Everyone"
) or UUID (eg."69abb139-ded6-4703-bda7-62e82210a048"
)
- group's display name (eg.
- $scimType
- what is the SCIM version of the resource
- possible values:
"1.1"
(for SCIM 1.1) or"2.0"
(for SCIM 2.0)
Returns: bool
Description: This method returns the group's UUID based on it's display name.
Parameters:
- $group
- group's display name (eg.
"Everyone"
)
- group's display name (eg.
- $scimType
- what is the SCIM version of the resource
- possible values:
"1.1"
(for SCIM 1.1) or"2.0"
(for SCIM 2.0)
Returns: string
Description: This method adds a user to a group if he does not already exist in it.
Parameters:
- $groupID
- group's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- group's UUID (eg.
- $userID
- user's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- user's UUID (eg.
Returns: null
Description: This method returns the UUID of all users that are part of a group.
Parameters:
- $groupID
- group's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- group's UUID (eg.
Returns: array
Description: This method returns the UUID of all groups in which a user is member.
Parameters:
- $userID
- user's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- user's UUID (eg.
Returns: array
Description: This method removes a user from a group.
Parameters:
- $groupID
- group's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- group's UUID (eg.
- $userID
- user's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- user's UUID (eg.
Returns: null
Description: This method removes all users from a group.
Parameters:
- $groupID
- group's UUID (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- group's UUID (eg.
Returns: null
Description: This method updates the timestamp of a resource.
Parameters:
- $resourceID
- UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- UUID of the resource (eg.
Returns: null
Description: This method returns the created
and lastUpdated
timestamps for a resource.
Parameters:
- $resourceID
- UUID of the resource (eg.
"69abb139-ded6-4703-bda7-62e82210a048"
)
- UUID of the resource (eg.
Returns: array
Description: This method generates and returns a random UUID.
Returns: string