[REST API] Set to readonly mode not working

Description

Hey guys! I hope you’re all doing great!
I’ve been seeking help for a little while now and couldn’t find it online unfortunately so posting here is kind of my last resort!

I made some kind of python bot interracting with rocket’s API and I’m trying to implement a feature that would set a channel to read only mode. So I’ve followed those instructions: https://rocket.chat/docs/developer-guides/rest-api/channels/setreadonly/

and here is my code :

 endpoint = config['BOT']['host'] + "/api/v1/channels.setReadOnly"
with app.app_context():
    parser = reqparse.RequestParser()
    parser.add_argument('roomName', required=True)
    parser.add_argument('key', required=True)
    args = parser.parse_args()
if (args['key'] == config['API']['key']):
    print("[i] -- KEY OK")
    params = {
        'roomName': args['roomName'],
        'readOnly': "true"
    }
    paramsjson = json.dumps(params)
    res = requests.post(url = endpoint, data = paramsjson, headers = headers)
    print(res.text)
else:
    print("[E] -- INCORRECT KEY, exitting...")
    exit()

So whenever I call this piece of code, the REST API returns a success status. And as you can see in the next image, the settings of the channel are updated but “grayed out”:

and my test user "Sorina could type in the channel with no problem. The only way to set the channel to read only mode is to make the change manually. When it is done manually then saved, the setting is not “grayed out” like in the first picture : (can’t post that second picture as I am a new user sorry…)

So yeah… I don’t really know what to do now… Do you guys have any idea ?

Server Setup Information

  • Version of Rocket.Chat Server: 2.1.1
  • Operating System: Ubuntu 18.04
  • Deployment Method: snap
  • Number of Running Instances: 1
  • NodeJS Version: v8;15.1
  • MongoDB Version: 3.6.14
  • Proxy: nginx
  • Firewalls involved: none

11

Here is the missing picture in the original post. That’s how it looks when i set it manually