def get_all_permissions(self) -> t.Mapping[str, bool]:
"""Get all course :class:`permissions` for this course role.
:returns: A name boolean mapping where the name is the name of the
permission and the value indicates if this user has this
permission.
"""
perms: t.Sequence[Permission] = (
Permission.query.
filter_by( # type: ignore
course_permission=True
).all()
)
result: t.MutableMapping[str, bool] = {}
for perm in perms:
if perm.name in self._permissions:
result[perm.name] = not perm.default_value
else:
result[perm.name] = perm.default_value
return result
评论列表
文章目录