skipcheck

TM1 client · Docs · Security

UserService

import io.skipcheck.tm1.client.service.security.UserService;

Users: /Users, the session's own user, their groups, and disconnecting them.

Group membership is set whole, with setGroups: 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
ODataPath groups = ODataPath.of("Groups");
return tm1.users()
    .create(UserPatch.builder()
        .name("alice")
        .password("initial-password")
        .bindGroups(groups.key("Planners"), groups.key("Sales"))
        .build());

Take a user out of one group by setting the rest:

// Groups are set whole: keep every group but Planners
return tm1.users()
    .groups("alice", ODataQuery.none().select(Group.NAME))
    .map(Group::name)
    .filter(group -> !group.equals("Planners"))
    .collectList()
    .flatMap(rest -> tm1.users().setGroups("alice", rest));

Lock a user out: disable them, then close their sessions.

// Stop the user logging in, then end the sessions they already have
return tm1.users()
    .update("alice", UserPatch.builder().enabled(false).build())
    .then(tm1.users().disconnect("alice"));

Members

UserService constructorA service sending its requests through session.
listGET Users, streamed.
getGET Users('name').
activeUserThe user this session is for.
createCreates a user, in the groups the patch binds (UserPatch.Builder#bindGroups).
updateChanges the properties the patch sets, such as Password or Enabled.
setGroupsPATCH Users('name') binding Groups.
deleteDELETE Users('name').
groupsGET Users('name')/Groups, streamed.
sessionsGET Users('name')/Sessions, streamed.
disconnectCloses every session the user has.

UserService

constructor
UserService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

list

Flux<User> list(ODataQuery query)

GET Users, streamed.

Parameters

query
what to select, expand, filter and order

Returns

the users

TM1 REST EntitySet Users

get

Mono<User> get(String name, ODataQuery query)

GET Users('name'). User names match ignoring case and spaces.

Parameters

name
the user's name
query
what to select and expand

Returns

the user, or a Tm1NotFoundException if there's none

TM1 REST EntitySet Users

activeUser

Mono<User> activeUser(ODataQuery query)

GET ActiveUser: the user this session is for.

Parameters

query
what to select and expand

Returns

the user

TM1 REST Singleton ActiveUser

create

Mono<User> create(UserPatch user)

POST Users: creates a user, in the groups the patch binds (UserPatch.Builder#bindGroups).

Parameters

user
the new user; it needs a name, and a password for Basic security

Returns

the user as created

TM1 REST EntitySet Users

update

Mono<Void> update(String name, UserPatch patch)

PATCH 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.

Parameters

name
the user's name
patch
the changes, without Groups

Returns

completes when the user is changed

Throws

IllegalArgumentException
if the patch sets or binds Groups, which replaces them: use setGroups

TM1 REST EntitySet Users

setGroups

Mono<Void> setGroups(String name, List<String> groups)

PATCH Users('name') binding Groups: makes the user's groups exactly these, leaving any not listed.

Parameters

name
the user's name
groups
the names of every group the user should be in

Returns

completes when the groups are set

delete

Mono<Void> delete(String name)

DELETE Users('name').

Parameters

name
the user's name

Returns

completes when the user is deleted

TM1 REST EntitySet Users

groups

Flux<Group> groups(String name, ODataQuery query)

GET Users('name')/Groups, streamed.

Parameters

name
the user's name
query
what to select

Returns

the user's groups

TM1 REST Navigation User/Groups

sessions

Flux<Session> sessions(String name, ODataQuery query)

GET Users('name')/Sessions, streamed: the user's sessions on the server.

Parameters

name
the user's name
query
what to select and expand

Returns

the user's sessions

TM1 REST Navigation User/Sessions

disconnect

Mono<Void> disconnect(String name)

tm1.Disconnect: closes every session the user has. Needs schema 10.2.2.6.

Parameters

name
the user's name

Returns

completes when they're disconnected

TM1 REST Action User/Disconnect

Also in the Javadoc.