blob: 722acc065d9779d9012ffec3db1c2599a45617c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.user;
import com.yahoo.vespa.hosted.controller.api.role.Role;
import java.util.Collection;
import java.util.List;
/**
* Management of {@link UserId}s as members of {@link Role}s.
*
* @author jonmv
*/
public interface UserManagement {
/** Creates the given role, or throws if the role already exists. */
void createRole(Role role);
/** Ensures the given role does not exist. */
void deleteRole(Role role);
/** Ensures the given users exist, and are part of the given role, or throws if the role does not exist. */
void addUsers(Role role, Collection<UserId> users);
/** Ensures the given user exist, and are part of the given roles, or throws if the roles does not exist. */
void addToRoles(UserId user, Collection<Role> roles);
/** Ensures none of the given users are part of the given role, or throws if the role does not exist. */
void removeUsers(Role role, Collection<UserId> users);
/** Ensures the given users are not part of the given role, or throws if the roles does not exist. */
void removeFromRoles(UserId user, Collection<Role> roles);
/** Returns all users in the given role, or throws if the role does not exist. */
List<User> listUsers(Role role);
/** Returns all roles of which the given user is part, or throws if the user does not exist */
List<Role> listRoles(UserId user);
/** Returns all roles */
List<Role> listRoles();
}
|