8000 Add support for Roles (by ID) APIs, package upgrades, and other api supports by MohammadWaleed · Pull Request #30 · MohammadWaleed/keycloak-admin-client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for Roles (by ID) APIs, package upgrades, and other api supports #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,20 +405,20 @@ Note: Ids are sent as clientScopeId or clientId and mapperId everything else is
| Update object stating whether role Authoirzation permissions have been initialized or not and a reference | updateRealmRoleManagementPermissions | ✔️ |
| Return List of Users that have the specified role name | getRealmRoleUsers | ✔️ |

## [Roles (by ID)]()
## [Roles (by ID)](https://www.keycloak.org/docs-api/7.0/rest-api/index.html#_roles_by_id_resource)

| API | Function Name | Supported |
|-----|:-------------:|:---------:|
| Get a specific role’s representation | | ❌ |
| Update the role | | ❌ |
| Delete the role | | ❌ |
| Make the role a composite role by associating some child roles | | ❌ |
| Get role’s children Returns a set of role’s children provided the role is a composite. | | ❌ |
| Remove a set of roles from the role’s composite | | ❌ |
| Get client-level roles for the client that are in the role’s composite | | ❌ |
| Get realm-level roles that are in the role’s composite | | ❌ |
| Return object stating whether role Authoirzation permissions have been initialized or not and a reference | | ❌ |
| Return object stating whether role Authoirzation permissions have been initialized or not and a reference | | ❌ |
| Get a specific role’s representation | getRealmRoleById | ✔️ |
| Update the role | updateRealmRoleById | ✔️ |
| Delete the role | deleteRealmRoleById | ✔️ |
| Make the role a composite role by associating some child roles | addCompositeRoleToRealmRoleByRoleId | ❌ |
| Get role’s children Returns a set of role’s children provided the role is a composite. | getRealmRoleCompositeRolesByRoleId | ✔️ |
| Remove a set of roles from the role’s composite | deleteCompositeRoleFromRealmRoleByRoleId | ❌ |
| Get client-level roles for the client that are in the role’s composite | getRealmRoleCompositeRolesForClientByRoleId | ✔️ |
| Get realm-level roles that are in the role’s composite | getRealmRoleCompositeRolesForRealmByRoleId | ✔️ |
| Return object stating whether role Authoirzation permissions have been initialized or not and a reference | getRealmRoleManagementPermissionsByRoleId | ✔️ |
| Return object stating whether role Authoirzation permissions have been initialized or not and a reference | updateRealmRoleManagementPermissionsByRoleId | ✔️ |

## [Scope Mappings]()

Expand Down Expand Up @@ -477,8 +477,8 @@ Note: Ids are sent as clientScopeId or clientId and mapperId everything else is
| Remove a social login provider from user | | ❌ |
| GET /{realm}/users/{id}/groups | getUserGroups | ✔️ |
| GET /{realm}/users/{id}/groups/count | getUserGroupsCount | ✔️ |
| PUT /{realm}/users/{id}/groups/{groupId} | | ❌ |
| DELETE /{realm}/users/{id}/groups/{groupId} | | ❌ |
| PUT /{realm}/users/{id}/groups/{groupId} | addUserToGroup | ✔️ |
| DELETE /{realm}/users/{id}/groups/{groupId} | deleteUserFromGroup | ✔️ |
| Impersonate the user | | ❌ |
| Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. | | ❌ |
| Get offline sessions associated with the user and client | | ❌ |
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"require": {
"php": ">=5.6.0",
"guzzlehttp/guzzle": "~6.0",
"guzzlehttp/guzzle-services": "~1.0"
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"guzzlehttp/guzzle-services": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 13 additions & 0 deletions src/Admin/KeycloakClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,26 @@
* @method array updateRealmRoleManagementPermissions (array $args = array()) { @command Keycloak updateRealmRoleManagementPermissions }
* @method array getRealmRoleUsers (array $args = array()) { @command Keycloak getRealmRoleUsers }
*
* @method array getRealmRoleById (array $args = array()) { @command Keycloak getRealmRoleById }
* @method array updateRealmRoleById (array $args = array()) { @command Keycloak updateRealmRoleById }
* @method array deleteRealmRoleById (array $args = array()) { @command Keycloak deleteRealmRoleById }
* @method array addCompositeRoleToRealmRoleByRoleId (array $args = array()) { @command Keycloak addCompositeRoleToRealmRoleByRoleId }
* @method array getRealmRoleCompositeRolesByRoleId (array $args = array()) { @command Keycloak getRealmRoleCompositeRolesByRoleId }
* @method array deleteCompositeRoleFromRealmRoleByRoleId (array $args = array()) { @command Keycloak deleteCompositeRoleFromRealmRoleByRoleId }
* @method array getRealmRoleCompositeRolesForClientByRoleId (array $args = array()) { @command Keycloak getRealmRoleCompositeRolesForClientByRoleId }
* @method array getRealmRoleCompositeRolesForRealmByRoleId (array $args = array()) { @command Keycloak getRealmRoleCompositeRolesForRealmByRoleId }
* @method array getRealmRoleManagementPermissionsByRoleId (array $args = array()) { @command Keycloak getRealmRoleManagementPermissionsByRoleId }
* @method array updateRealmRoleManagementPermissionsByRoleId (array $args = array()) { @command Keycloak updateRealmRoleManagementPermissionsByRoleId }
*
* @method array createUser(array $args = array()) { @command Keycloak createUser }
* @method array getUsers(array $args = array()) { @command Keycloak getUsers }
* @method array getUser(array $args = array()) { @command Keycloak getUser }
* @method array getUserGroups(array $args = array()) { @command Keycloak getUserGroups }
* @method array getUserGroupsCount(array $args = array()) { @command Keycloak getUserGroupsCount }
* @method array updateUser(array $args = array()) { @command Keycloak updateUser }
* @method array deleteUser(array $args = array()) { @command Keycloak deleteUser }
* @method array addUserToGroup(array $args = array()) { @command Keycloak addUserToGroup }
* @method array deleteUserFromGroup(array $args = array()) { @command Keycloak deleteUserFromGroup }
*
*/

Expand Down
269 changes: 269 additions & 0 deletions src/Admin/Resources/keycloak-1_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -4791,6 +4791,223 @@
),
),

// Roles (by ID)

'getRealmRoleById' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}',
'description' => 'Get a specific role’s representation',
'httpMethod' => 'GET',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),

'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
),
),

'updateRealmRoleById' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}',
'description' => 'Update the role',
'httpMethod' => 'PUT',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),

'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
) + $RoleRepresentation,
),

'deleteRealmRoleById' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}',
'description' => 'Delete the role',
'httpMethod' => 'DELETE',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),

'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
),
),

'addCompositeRoleToRealmRoleByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/composites',
'description' => 'Add a composite to the role',
'httpMethod' => 'POST',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
'roles' => array(
'location' => 'fullBody',
'type' => 'array',
'items' => array(
'type' => 'object', 'properties' => $RoleRepresentation
),
'required' => true
),
)
),

'getRealmRoleCompositeRolesByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/composites',
'description' => 'Get composites of the role',
'httpMethod' => 'GET',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
)
),

'deleteCompositeRoleFromRealmRoleByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/composites',
'description' => 'Remove roles from the role’s composite',
'httpMethod' => 'DELETE',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
'roles' => array(
'location' => 'fullBody',
'type' => 'array',
'items' => array(
'type' => 'object', 'properties' => $RoleRepresentation
),
'required' => true
),
)
),

'getRealmRoleCompositeRolesForClientByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/composites/clients/{client}',
'description' => 'Get client-level roles for the client that are in the role’s composite',
'httpMethod' => 'GET',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
'client' => array(
'location' => 'uri',
'description' => 'client id (not name!)',
'type' => 'string',
'required' => true,
),
)
),

'getRealmRoleCompositeRolesForRealmByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/composites/realm',
'description' => 'Get realm-level roles of the role’s composite',
'httpMethod' => 'GET',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
)
),

'getRealmRoleManagementPermissionsByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/management/permissions',
'description' => 'Return object stating whether role Authoirzation permissions have been initialized or not and a reference',
'httpMethod' => 'GET',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
)
),

'updateRealmRoleManagementPermissionsByRoleId' => array(
'uri' => 'auth/admin/realms/{realm}/roles-by-id/{role-id}/management/permissions',
'description' => 'Update object stating whether role Authoirzation permissions have been initialized or not and a reference',
'httpMethod' => 'PUT',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'realm name (not id!)',
'type' => 'string',
'required' => true,
),
'role-id' => array(
'location' => 'uri',
'type' => 'string',
'required' => true,
),
) + $ManagementPermissionReference
),

// Users

'createUser' => array(
Expand Down Expand Up @@ -4963,5 +5180,57 @@
),
),

'addUserToGroup' => array(
'uri' => 'auth/admin/realms/{realm}/users/{id}/groups/{groupId}',
'description' => 'Assign a specific user to a specific group',
'httpMethod' => 'PUT',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'The Realm name',
'type' => 'string',
'required' => true,
),
'id' => array(
'location' => 'uri',
'description' => 'User id',
'type' => 'string',
'required' => true,
),
'groupId' => array(
'location' => 'uri',
'description' => 'Group id',
'type' => 'string',
'required' => true,
),
),
),

'deleteUserFromGroup' => array(
'uri' => 'auth/admin/realms/{realm}/users/{id}/groups/{groupId}',
'description' => 'Remove a specific user from a specific group',
'httpMethod' => 'DELETE',
'parameters' => array(
'realm' => array(
'location' => 'uri',
'description' => 'The Realm name',
'type' => 'string',
'required' => true,
),
'id' => array(
'location' => 'uri',
'description' => 'User id',
'type' => 'string',
'required' => true,
),
'groupId' => array(
'location' => 'uri',
'description' => 'Group id',
'type' => 'string',
'required' => true,
),
),
),

) //End of Operations Array
);//End of return array
0