pusher / chatkit-server-php

PHP SDK for Pusher Chatkit
https://pusher.com/chatkit
MIT License
35 stars 20 forks source link

Delete room? #13

Closed alexey13 closed 6 years ago

alexey13 commented 6 years ago

Good day to all! I use js client, php server. When trying to delete room in front got 401 and as i see i cant delete room using php too? Thanks guys!

hamchapman commented 6 years ago

The default role that users are given doesn't have permissions to delete a room. You can find out more about that here: https://docs.pusher.com/chatkit/roles-and-permissions#initial-app-permissions

The "fix" here is to either change the permissions associated with the default role in your app, or to assign the user who you want to be able to delete the room an appropriate role that has the room:delete permission.

We could add the ability to delete rooms from the PHP SDK as well though. Although it should be quite easy to add if you're in need of it. We're more than happy to accept a pull request!

alexey13 commented 6 years ago

Cant understand why its not working. Need some help guys. I trying to make user admin

`public function makeItModerator($user_id) {
$body = array( "name" => "admin" );

    $token = $this->generateToken(array(
        "user_id" => $user_id,
        "su" => true
    ));

    $ch = $this->createCurl(
        $this->api_settings,
        "/users/" . $user_id . "/roles",
        $token,
        "PUT",
        $body
    );

    return $this->execCurl($ch);

}`

alexey13 commented 6 years ago

Found reason. I should send it to different url