0
# User & Organization Management
1
2
Complete user account and organization administration including roles, permissions, settings management, and organizational hierarchy.
3
4
## Capabilities
5
6
### User Management
7
8
Comprehensive user account administration with role assignments and permission control.
9
10
```python { .api }
11
def users(self, **kwargs) -> list:
12
"""List users with optional filtering."""
13
14
def get_user(self, user_id: Union[int, str]) -> dict:
15
"""Get specific user by ID."""
16
17
def add_user(self, user: Union['MISPUser', dict], **kwargs) -> dict:
18
"""Create new user account."""
19
20
def update_user(self, user: Union['MISPUser', dict], user_id: Union[int, str] = None) -> dict:
21
"""Update existing user account."""
22
23
def delete_user(self, user_id: Union[int, str]) -> dict:
24
"""Delete user account."""
25
26
def change_user_password(self, user_id: Union[int, str], password: str) -> dict:
27
"""Change user password."""
28
29
def toggle_user_role(self, user_id: Union[int, str], role_id: int) -> dict:
30
"""Change user role."""
31
```
32
33
### Organization Management
34
35
Organization administration including creation, updates, and relationship management.
36
37
```python { .api }
38
def organisations(self, scope: str = 'local', **kwargs) -> list:
39
"""List organizations."""
40
41
def get_organisation(self, org_id: Union[int, str]) -> dict:
42
"""Get specific organization."""
43
44
def add_organisation(self, organisation: Union['MISPOrganisation', dict]) -> dict:
45
"""Create new organization."""
46
47
def update_organisation(self, organisation: Union['MISPOrganisation', dict], org_id: Union[int, str] = None) -> dict:
48
"""Update organization."""
49
50
def delete_organisation(self, org_id: Union[int, str]) -> dict:
51
"""Delete organization."""
52
```
53
54
### Role Management
55
56
User role definitions and permission management.
57
58
```python { .api }
59
def roles(self, **kwargs) -> list:
60
"""Get available user roles."""
61
62
def get_role(self, role_id: Union[int, str]) -> dict:
63
"""Get specific role definition."""
64
65
def set_default_role(self, role_id: int) -> dict:
66
"""Set default role for new users."""
67
```
68
69
## Usage Examples
70
71
### User Operations
72
73
```python
74
from pymisp import PyMISP, MISPUser
75
76
misp = PyMISP('https://misp.example.com', 'your-api-key')
77
78
# Create new user
79
user = MISPUser()
80
user.email = 'analyst@company.com'
81
user.org_id = 1
82
user.role_id = 3 # Regular user role
83
84
response = misp.add_user(user)
85
86
# List all users
87
users = misp.users()
88
89
# Update user
90
misp.change_user_password(user_id, 'new_secure_password')
91
```
92
93
### Organization Operations
94
95
```python
96
from pymisp import MISPOrganisation
97
98
# Create organization
99
org = MISPOrganisation()
100
org.name = "Cybersec Corp"
101
org.description = "Cybersecurity company"
102
org.type = "Private Sector"
103
org.nationality = "US"
104
105
misp.add_organisation(org)
106
107
# List organizations
108
orgs = misp.organisations(scope='all')
109
```