Skip to content

ChannelRolePermission

Class  ·  Sharkord\Models\ChannelRolePermission

Class ChannelRolePermission

Represents a single role-level permission entry for a channel, as returned by the channels.getPermissions RPC. Each entry corresponds to one ChannelPermissionFlag for one role, and carries an explicit allow/deny flag.

$channel->getPermissions()->then(function(array $permissions) {
foreach ($permissions['rolePermissions'] as $entry) {
$state = $entry->allow ? 'allowed' : 'denied';
echo "Role {$entry->roleId} — {$entry->permission->value}: {$state}\n";
}
});

ChannelRolePermission constructor.

Parameters

ParameterTypeDescription
$channelIdintThe ID of the channel this entry belongs to.
$roleIdintThe ID of the role this entry belongs to.
$permissionChannelPermissionFlagThe permission flag this entry covers.
$allowboolWhether the permission is granted (true) or denied (false).
$createdAtintUnix timestamp (ms) when this entry was created.
$updatedAt?intUnix timestamp (ms) when this entry was last updated, or null.

Factory method to create a ChannelRolePermission from a raw API data array.

Parameters

ParameterTypeDescription
$rawarrayThe raw permission entry from the server.

Returns self


Returns the permission entry as a plain array. Useful for debugging.

Returns array