Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@MrCrayfish
Copy link
Contributor

Description

Currently it not possible to use WorkOS permissions in a PHP application as the Role resource is missing the permissions attribute. This PR simply addresses the issue. PHPDocs have also been added to the Role class.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[✔️] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

PHP example will need updating: https://workos.com/docs/reference/roles

Expected new PHP example based on JSON example.

<?php

$role = [
    "object" => "role",
    "id" => "role_01EHQMYV6MBK39QC5PZXHY59C3",
    "name" => "Member",
    "slug" => "member",
    "description" => "Access to basic resources",
    "permissions" => ["posts:read", "posts:write"],
    "type" => "EnvironmentRole",
    "created_at" => "2021-07-26T18:55:16.072Z",
    "updated_at" => "2021-07-26T18:55:16.072Z",
];

@MrCrayfish MrCrayfish requested a review from a team as a code owner June 16, 2025 12:49
@MrCrayfish MrCrayfish requested a review from mattgd June 16, 2025 12:49
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added the permissions attribute to lib/Resource/Role.php to support WorkOS permissions functionality in PHP applications, enabling access control features like posts:read and posts:write.

  • Added missing permissions array property to Role class with PHPDoc annotations
  • Update requires corresponding documentation changes at workos.com/docs/reference/roles

1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile

@mattgd
Copy link
Contributor

mattgd commented Jun 16, 2025

Thanks for adding this @MrCrayfish! Do you mind updating the OrganizationsTest#organizationRolesResponseFixture to include permissions to get tests passing? Some combination of posts:read, posts:write, or an empty array is good.

@MrCrayfish
Copy link
Contributor Author

Fixtures are now updated as of 2ac7ad5 and tests are passing locally. Should be ready to go now.

@mattgd mattgd merged commit e3db32f into workos:main Jun 17, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants