csle_rest_api.util package
Submodules
csle_rest_api.util.rest_api_util module
- csle_rest_api.util.rest_api_util.check_if_user_edit_is_authorized(request, user: csle_common.dao.management.management_user.ManagementUser) Union[None, csle_common.dao.management.management_user.ManagementUser, Tuple[flask.wrappers.Response, int]] [source]
Check if a user is authorized to edit another user
- Parameters
request – the request to extract the user from
- Returns
the non-authorized response or the user
- csle_rest_api.util.rest_api_util.check_if_user_is_authorized(request, requires_admin: bool = False) Union[None, Tuple[flask.wrappers.Response, int]] [source]
Checks if a user request is authorized
- Parameters
request – the request to check
requires_admin – boolean flag indicating whether only admins are authorized or not
- Returns
the non-authorized response or None
- csle_rest_api.util.rest_api_util.set_container_terminal_winsize(ssh_channel: paramiko.channel.Channel, row: int, col: int, xpix: int = 0, ypix: int = 0) None [source]
Set shell window size of the host terminal
- Parameters
ssh_channel – the ssh_channel of the shell
row – the number of rows of the new window size
col – the number of cols of the new window size
xpix – the number of x pixels of the new size
ypix – the number of y pixels of the new size
- Returns