Esempio n. 1
0
    def remove_role(self, user_id, role_name):
        """Removes a role from a user.
        `REST Documentation <https://console.us.code42.com/apidocviewer/#UserRole-delete>`__

        Args:
            user_id (int): An ID for a user.
            role_name (str): The name of the role to unassign from the user.

        Returns:
            :class:`py42.response.Py42Response`
        """

        # use quote instead of params here so that %20 is used instead of + for spaces.
        role_name = quote(role_name)
        uri = u"/api/UserRole?userId={}&roleName={}".format(user_id, role_name)
        return self._connection.delete(uri)
Esempio n. 2
0
 def get_file_version_list(self, deviceGuid, file_md5, file_sha256, path):
     params = "fileSHA256={}&fileMD5={}&deviceGuid={}&path={}"
     params = params.format(file_sha256, file_md5, deviceGuid, quote(path))
     uri = u"/api/v1/FileVersionListing?{}".format(params)
     return self._connection.get(uri)