Organizations
Please contact support at [email protected] if you would like to manage an organization. Tell us what you're doing, and select an organization name, title, description, email address, and url. We will then create your organization and make your account an admin of the organization. You will then be able to create new users in your org and generate a temporary authentication link for any user.
Source code in src/cocalc_api/org.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
add_admin(name, user)
Make the user with given account_id or email an admin of the named organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
user
|
str
|
email or account_id |
required |
Source code in src/cocalc_api/org.py
71 72 73 74 75 76 77 78 79 80 81 | |
add_user(name, user)
Make the user with given account_id or email a member of the named organization. Only site admins can do this. If you are an org admin, instead use user to create new users in your organization, or contact support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
user
|
str
|
email or account_id |
required |
Source code in src/cocalc_api/org.py
83 84 85 86 87 88 89 90 91 92 93 94 95 | |
create(name)
Create an organization (site admins only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the organization; must be globally unique, at most 39 characters, and CANNOT BE CHANGED. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Organization data. |
Source code in src/cocalc_api/org.py
24 25 26 27 28 29 30 31 32 33 34 35 36 | |
create_token(user)
Create a token that provides temporary access to the given account. You must be an admin for the org that the user belongs to or a site admin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
str
|
email address or account_id |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TokenType |
TokenType
|
token that grants temporary access |
Notes
The returned TokenType has the following fields:
token(str): The random token itself, which you may retain in case you want to explicitly expire it early.url(str): The url that the user should visit to sign in as them. You can also test out this url, since the token works multiple times.
Source code in src/cocalc_api/org.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
create_user(name, email, firstName=None, lastName=None, password=None)
Create a new cocalc account that is a member of the named organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
email
|
str
|
email address |
required |
firstName
|
Optional[str]
|
optional first name of the user |
None
|
lastName
|
Optional[str]
|
optional last name of the user |
None
|
password
|
Optional[str]
|
optional password (will be randomized if not given; you can instead use create_token to grant temporary account access). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
account_id of the new user |
Source code in src/cocalc_api/org.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
expire_token(token)
Immediately expire a token created using create_token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
a token |
required |
Source code in src/cocalc_api/org.py
146 147 148 149 150 151 152 153 154 | |
get(name)
Get an organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the organization. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Organization data. |
Source code in src/cocalc_api/org.py
38 39 40 41 42 43 44 45 46 47 48 49 | |
get_all()
Get all organizations (site admins only).
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Organization data. |
Source code in src/cocalc_api/org.py
14 15 16 17 18 19 20 21 22 | |
get_users(name)
Return list of all accounts that are members of the named organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
Returns:
| Type | Description |
|---|---|
list[OrganizationUser]
|
list[OrganizationUser] |
Notes
The returned OrganizationUser has the following fields:
first_name(str)last_name(str)account_id(str): a uuidemail_address(str)
Source code in src/cocalc_api/org.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
message(name, subject, body)
Send a message from you to every account that is a member of the named organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
subject
|
str
|
plain text subject of the message |
required |
body
|
str
|
markdown body of the message (math typesetting works) |
required |
Source code in src/cocalc_api/org.py
199 200 201 202 203 204 205 206 207 208 209 210 | |
remove_admin(name, user)
Remove an admin from an organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
user
|
str
|
email or account_id |
required |
Source code in src/cocalc_api/org.py
188 189 190 191 192 193 194 195 196 197 | |
remove_user(name, user)
Remove a user from an organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the organization |
required |
user
|
str
|
email or account_id |
required |
Source code in src/cocalc_api/org.py
177 178 179 180 181 182 183 184 185 186 | |
set(name, title=None, description=None, email_address=None, link=None)
Set properties of an organization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the organization. |
required |
title
|
Optional[str]
|
The title of the organization. |
None
|
description
|
Optional[str]
|
Description of the organization. |
None
|
email_address
|
Optional[str]
|
Email address to reach the organization (nothing to do with a cocalc account). |
None
|
link
|
Optional[str]
|
A website of the organization. |
None
|
Source code in src/cocalc_api/org.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |