blob: 49f249dd2d7cbfade5e68c1eec5371d1b1c29595 (
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
43
44
45
46
47
48
49
50
51
52
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.nodeagent;
import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixUser;
import java.util.Objects;
/**
* @author freva
*/
public class UserScope {
private final UnixUser root;
private final UnixUser vespa;
private final UserNamespace namespace;
private UserScope(UnixUser root, UnixUser vespa, UserNamespace namespace) {
this.root = Objects.requireNonNull(root);
this.vespa = Objects.requireNonNull(vespa);
this.namespace = Objects.requireNonNull(namespace);
}
public UnixUser root() {
return root;
}
public UnixUser vespa() {
return vespa;
}
public UserNamespace namespace() {
return namespace;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserScope userScope = (UserScope) o;
return root.equals(userScope.root) && vespa.equals(userScope.vespa) && namespace.equals(userScope.namespace);
}
@Override
public int hashCode() {
return Objects.hash(root, vespa, namespace);
}
/** Creates user scope with default root and vespa user */
public static UserScope create(UserNamespace namespace) {
return new UserScope(UnixUser.ROOT, UnixUser.VESPA, namespace);
}
}
|