MCPcopy Create free account
hub / github.com/alephdata/aleph / view

Function view

aleph/views/roles_api.py:167–204  ·  view source on GitHub ↗

Retrieve role details. --- post: summary: Retrieve role details description: > Fetch detailed information about a role that the user is entitled to access, e.g. their own role, or a group they are part of. parameters: - in: path name: i

(id)

Source from the content-addressed store, hash-verified

165
166@blueprint.route("/api/2/roles/<int:id>", methods=["GET"])
167def view(id):
168 """Retrieve role details.
169 ---
170 post:
171 summary: Retrieve role details
172 description: >
173 Fetch detailed information about a role that the user is
174 entitled to access, e.g. their own role, or a group they
175 are part of.
176 parameters:
177 - in: path
178 name: id
179 required: true
180 description: role ID
181 schema:
182 type: integer
183 responses:
184 '200':
185 description: OK
186 content:
187 application/json:
188 schema:
189 $ref: '#/components/schemas/Role'
190 tags:
191 - Role
192 """
193 role = obj_or_404(Role.by_id(id))
194 require(request.authz.can_read_role(role.id))
195 data = role.to_dict()
196 if request.authz.can_write_role(role.id):
197 data.update(get_deep_role(role))
198 if SETTINGS.MAINTENANCE:
199 # Prevent continuous fetching of profile information in maintenance mode.
200 # This is a workaround for the improper permission system (see "write" access).
201 # This results in the email address not being shown on the profile page in
202 # maintenance mode, but there is no other way to prevent constant re-fetching.
203 data.update({"shallow": False})
204 return RoleSerializer.jsonify(data)
205
206
207@blueprint.route("/api/2/roles/<int:id>", methods=["POST", "PUT"])

Callers

nothing calls this directly

Calls 9

obj_or_404Function · 0.90
requireFunction · 0.90
get_deep_roleFunction · 0.90
can_read_roleMethod · 0.80
can_write_roleMethod · 0.80
jsonifyMethod · 0.80
by_idMethod · 0.45
to_dictMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected