0
# Permissions
1
2
Server permission management for controlling user capabilities and access rights within Rocket.Chat. Allows querying and updating permission settings.
3
4
## Capabilities
5
6
### Permission Management
7
8
```python { .api }
9
def permissions_list_all(self, **kwargs):
10
"""
11
List all permissions in the system.
12
13
Parameters:
14
- updatedSince (str, optional): ISO date string to get permissions updated since
15
16
Returns:
17
requests.Response: List of all system permissions
18
"""
19
20
def permissions_update(self, permissions, **kwargs):
21
"""
22
Update permission settings.
23
24
Parameters:
25
- permissions (list): List of permission objects to update
26
27
Returns:
28
requests.Response: Permission update result
29
"""
30
```
31
32
## Permission Structure
33
34
```python { .api }
35
PermissionObject = {
36
"_id": "str", # Permission ID
37
"roles": ["str"], # Roles that have this permission
38
"level": "str", # Permission level (settings, rooms, etc.)
39
"settingId": "str", # Related setting ID
40
"group": "str", # Permission group
41
"section": "str", # Permission section
42
"sorter": "int", # Sort order
43
"properties": "dict", # Additional properties
44
"_updatedAt": "datetime" # Last update timestamp
45
}
46
```
47
48
## Usage Examples
49
50
```python
51
# List all permissions
52
permissions = rocket.permissions_list_all()
53
print(f"Total permissions: {len(permissions.json()['permissions'])}")
54
55
# Find specific permission
56
all_perms = permissions.json()['permissions']
57
chat_perms = [p for p in all_perms if 'message' in p['_id'].lower()]
58
print(f"Message-related permissions: {len(chat_perms)}")
59
60
# Update permissions (admin required)
61
permission_updates = [
62
{
63
"_id": "post-readonly",
64
"roles": ["admin", "moderator", "owner"]
65
}
66
]
67
result = rocket.permissions_update(permission_updates)
68
print("Permissions updated:", result.json())
69
```