Class UserService
java.lang.Object
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(String, List): 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"));
-
Constructor Summary
ConstructorsConstructorDescriptionUserService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<User> activeUser(ODataQuery query) GET ActiveUser: the user this session is for.reactor.core.publisher.Mono<User> POST Users: creates a user, in the groups the patch binds (UserPatch.Builder#bindGroups).reactor.core.publisher.Mono<Void> DELETE Users('name').reactor.core.publisher.Mono<Void> disconnect(String name) tm1.Disconnect: closes every session the user has.reactor.core.publisher.Mono<User> get(String name, ODataQuery query) GET Users('name').reactor.core.publisher.Flux<Group> groups(String name, ODataQuery query) GET Users('name')/Groups, streamed.reactor.core.publisher.Flux<User> list(ODataQuery query) GET Users, streamed.reactor.core.publisher.Flux<Session> sessions(String name, ODataQuery query) GET Users('name')/Sessions, streamed: the user's sessions on the server.reactor.core.publisher.Mono<Void> PATCH Users('name')bindingGroups: makes the user's groups exactly these, leaving any not listed.reactor.core.publisher.Mono<Void> PATCH Users('name'): changes the properties the patch sets, such asPasswordorEnabled.
-
Constructor Details
-
UserService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
GET Users, streamed.- Parameters:
query- what to select, expand, filter and order- Returns:
- the users
-
get
@Tm1Endpoint("EntitySet Users") public reactor.core.publisher.Mono<User> get(String name, ODataQuery query) GET Users('name'). User names match ignoring case and spaces.- Parameters:
name- the user's namequery- what to select and expand- Returns:
- the user, or a
Tm1NotFoundExceptionif there's none
-
activeUser
@Tm1Endpoint("Singleton ActiveUser") public reactor.core.publisher.Mono<User> activeUser(ODataQuery query) GET ActiveUser: the user this session is for.- Parameters:
query- what to select and expand- Returns:
- the user
-
create
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
-
update
@Tm1Endpoint("EntitySet Users") public reactor.core.publisher.Mono<Void> update(String name, UserPatch patch) PATCH Users('name'): changes the properties the patch sets, such asPasswordorEnabled. TM1 (11.8) sends no ETag for a user, so there's noIf-Matchform.- Parameters:
name- the user's namepatch- the changes, withoutGroups- Returns:
- completes when the user is changed
- Throws:
IllegalArgumentException- if the patch sets or bindsGroups, which replaces them: usesetGroups(String, List)
-
setGroups
@Tm1Endpoint("EntitySet Users") @Tm1Endpoint("Navigation User/Groups") public reactor.core.publisher.Mono<Void> setGroups(String name, List<String> groups) PATCH Users('name')bindingGroups: makes the user's groups exactly these, leaving any not listed.- Parameters:
name- the user's namegroups- the names of every group the user should be in- Returns:
- completes when the groups are set
-
delete
DELETE Users('name').- Parameters:
name- the user's name- Returns:
- completes when the user is deleted
-
groups
@Tm1Endpoint("Navigation User/Groups") public reactor.core.publisher.Flux<Group> groups(String name, ODataQuery query) GET Users('name')/Groups, streamed.- Parameters:
name- the user's namequery- what to select- Returns:
- the user's groups
-
sessions
@Tm1Endpoint("Navigation User/Sessions") public reactor.core.publisher.Flux<Session> sessions(String name, ODataQuery query) GET Users('name')/Sessions, streamed: the user's sessions on the server.- Parameters:
name- the user's namequery- what to select and expand- Returns:
- the user's sessions
-
disconnect
@Tm1Endpoint("Action User/Disconnect") public reactor.core.publisher.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
-