Ejemplo n.º 1
0
    def get_current_user(self):
        """ Get user and group assignments of this session

        :return: instance of TM1py.User
        """
        request = "/api/v1/ActiveUser?$expand=Groups"
        response = self._rest.GET(request)
        return User.from_dict(response.json())
Ejemplo n.º 2
0
    def get_current_user(self, **kwargs) -> User:
        """ Get user and group assignments of this session

        :return: instance of TM1py.User
        """
        url = "/api/v1/ActiveUser?$select=Name,FriendlyName,Password,Type,Enabled&$expand=Groups"
        response = self._rest.GET(url, **kwargs)
        return User.from_dict(response.json())
Ejemplo n.º 3
0
    def get_active_users(self, **kwargs) -> List[User]:
        """ Get the activate users in TM1

        :return: List of TM1py.User instances
        """
        url = '/api/v1/Users?$filter=IsActive eq true&$expand=Groups'
        response = self._rest.GET(url, **kwargs)
        users = [User.from_dict(user) for user in response.json()['value']]
        return users
Ejemplo n.º 4
0
    def get_active_users(self):
        """ Get the activate users in TM1 Server

        :return: List of TM1py.User instances
        """
        request = '/api/v1/Users?$filter=IsActive eq true&$expand=Groups'
        response = self._rest.GET(request)
        users = [User.from_dict(user) for user in response.json()['value']]
        return users
Ejemplo n.º 5
0
    def get_all_users(self):
        """ Get all users from TM1 Server

        :return: List of TM1py.User instances
        """
        request = '/api/v1/Users?$expand=Groups'
        response = self._rest.GET(request)
        users = [User.from_dict(user) for user in response.json()['value']]
        return users
Ejemplo n.º 6
0
    def get_user(self, user_name):
        """ Get user from TM1 Server

        :param user_name:
        :return: instance of TM1py.User
        """
        request = '/api/v1/Users(\'{}\')?$expand=Groups'.format(user_name)
        response = self._rest.GET(request)
        return User.from_dict(response.json())
Ejemplo n.º 7
0
    def get_all_users(self, **kwargs):
        """ Get all users from TM1 Server

        :return: List of TM1py.User instances
        """
        url = '/api/v1/Users?$select=Name,FriendlyName,Password,Type,Enabled&$expand=Groups'
        response = self._rest.GET(url, **kwargs)
        users = [User.from_dict(user) for user in response.json()['value']]
        return users
Ejemplo n.º 8
0
    def get_user(self, user_name):
        """ Get user from TM1 Server

        :param user_name:
        :return: instance of TM1py.User
        """
        user_name = self.determine_actual_user_name(user_name)
        request = "/api/v1/Users('{}')?$expand=Groups".format(user_name)
        response = self._rest.GET(request)
        return User.from_dict(response.json())
Ejemplo n.º 9
0
    def get_users_from_group(self, group_name):
        """ Get all users from group

        :param group_name:
        :return: List of TM1py.User instances
        """
        request = '/api/v1/Groups(\'{}\')?$expand=Users($expand=Groups)'.format(group_name)
        response = self._rest.GET(request)
        users = [User.from_dict(user) for user in response.json()['Users']]
        return users
Ejemplo n.º 10
0
    def get_user(self, user_name: str, **kwargs) -> User:
        """ Get user from TM1 Server

        :param user_name:
        :return: instance of TM1py.User
        """
        user_name = self.determine_actual_user_name(user_name, **kwargs)
        url = format_url(
            "/api/v1/Users('{}')?$select=Name,FriendlyName,Password,Type,Enabled&$expand=Groups",
            user_name)
        response = self._rest.GET(url, **kwargs)
        return User.from_dict(response.json())
Ejemplo n.º 11
0
    def get_users_from_group(self, group_name: str, **kwargs):
        """ Get all users from group

        :param group_name:
        :return: List of TM1py.User instances
        """
        url = format_url(
            "/api/v1/Groups('{}')?$expand=Users($select=Name,FriendlyName,Password,Type,Enabled;$expand=Groups)",
            group_name)
        response = self._rest.GET(url, **kwargs)
        users = [User.from_dict(user) for user in response.json()['Users']]
        return users