UserService
from skipcheck_tm1.services import UserService Users: /Users, the session's own user, their groups, and disconnecting them.
Group membership is set whole, with set_groups: binding Groups in a
user PATCH replaces them. TM1 (11.8) has no safe way to leave one group: a
DELETE Users('u')/Groups('g')/$ref, which OData means as "remove the link",
deletes the group, for everyone. This service never sends it.
Create a user in some groups, binding them by path:
# A user in two existing groups, bound by their paths
groups = ODataPath.of("Groups")
alice = UserPatch.builder().name("alice").password("initial-password").bind_groups(groups.key("Planners"), groups.key("Sales")).build()
return tm1.users.create(alice)
Take a user out of one group by setting the rest:
# Groups are set whole: keep every group but Planners
groups = tm1.users.groups("alice", ODataQuery.none().select(Group.NAME))
tm1.users.set_groups("alice", [group.name for group in groups if group.name and group.name != "Planners"])
Lock a user out: disable them, then close their sessions.
# Stop the user logging in, then end the sessions they already have
tm1.users.update("alice", UserPatch.builder().enabled(False).build())
tm1.users.disconnect("alice")
The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncUserService.
Members
list | GET Users. |
get | GET Users('name'); user names match ignoring case and spaces. |
active_user | The user this session is for. |
create | Creates a user, in the groups the patch binds (UserPatch.Builder.bind_groups). |
update | Changes the properties the patch sets, such as Password or Enabled. |
set_groups | PATCH Users('name') binding Groups. |
delete | DELETE Users('name'). |
groups | GET Users('name')/Groups. |
sessions | The user's sessions on the server. |
disconnect | Closes every session the user has. |
list
list(query: ODataQuery | None = None, **options: Any) -> list[User]GET Users.
TM1 REST EntitySet Users
get
get(name: str, query: ODataQuery | None = None, **options: Any) -> UserGET Users('name'); user names match ignoring case and spaces. A Tm1NotFoundError if there's none.
TM1 REST EntitySet Users
active_user
active_user(query: ODataQuery | None = None, **options: Any) -> UserGET ActiveUser: the user this session is for.
TM1 REST Singleton ActiveUser
create
create(user: Any) -> UserPOST Users: creates a user, in the groups the patch binds (UserPatch.Builder.bind_groups). It needs a name, and a password for Basic security.
TM1 REST EntitySet Users
update
update(name: str, patch: Any) -> NonePATCH Users('name'): changes the properties the patch sets, such as Password or Enabled. TM1 (11.8) sends no ETag for a user, so there's no If-Match form.
Raises ValueError if the patch sets or binds Groups, which replaces them: use set_groups.
TM1 REST EntitySet Users
set_groups
set_groups(name: str, groups: Sequence[str]) -> NonePATCH Users('name') binding Groups: makes the user's groups exactly these, leaving any not listed. Never a $ref delete, which deletes the group itself.
TM1 REST EntitySet Users Navigation User/Groups
delete
delete(name: str) -> NoneDELETE Users('name').
TM1 REST EntitySet Users
groups
groups(name: str, query: ODataQuery | None = None, **options: Any) -> list[Group]GET Users('name')/Groups.
TM1 REST Navigation User/Groups
sessions
sessions(name: str, query: ODataQuery | None = None, **options: Any) -> list[Session]GET Users('name')/Sessions: the user's sessions on the server.
TM1 REST Navigation User/Sessions
disconnect
disconnect(name: str) -> Nonetm1.Disconnect: closes every session the user has. Needs schema 10.2.2.6.
TM1 REST Action User/Disconnect