|
26 | 26 | package com.botdetector.model; |
27 | 27 |
|
28 | 28 | import com.google.common.collect.ImmutableSet; |
29 | | -import java.util.Arrays; |
30 | 29 | import lombok.Getter; |
31 | | -import lombok.RequiredArgsConstructor; |
32 | 30 | import static com.botdetector.model.AuthTokenPermission.*; |
33 | 31 |
|
34 | 32 | @Getter |
35 | | -@RequiredArgsConstructor |
36 | 33 | public enum AuthTokenType |
37 | 34 | { |
38 | 35 | /** |
39 | 36 | * No permissions |
40 | 37 | */ |
41 | | - NONE(ImmutableSet.of()), |
| 38 | + NONE(), |
42 | 39 |
|
43 | 40 | /** |
44 | 41 | * All permissions |
45 | 42 | */ |
46 | | - DEV(Arrays.stream(AuthTokenPermission.values()).collect(ImmutableSet.toImmutableSet())), |
| 43 | + DEV(AuthTokenPermission.values()), |
47 | 44 |
|
48 | 45 | /** |
49 | 46 | * Can perform discord verification and retrieve clan rank updates |
50 | 47 | */ |
51 | | - MOD(ImmutableSet.of(VERIFY_DISCORD, GET_CLAN_RANK_UPDATES)), |
| 48 | + MOD(VERIFY_DISCORD, GET_CLAN_RANK_UPDATES), |
| 49 | + |
| 50 | + /** |
| 51 | + * Can perform discord verification |
| 52 | + */ |
| 53 | + DISCORD(VERIFY_DISCORD), |
52 | 54 |
|
53 | 55 | /** |
54 | 56 | * Can retrieve clan rank updates |
55 | 57 | */ |
56 | | - CLAN(ImmutableSet.of(GET_CLAN_RANK_UPDATES)) |
| 58 | + CLAN(GET_CLAN_RANK_UPDATES) |
57 | 59 | ; |
58 | 60 |
|
59 | 61 | private final ImmutableSet<AuthTokenPermission> permissions; |
60 | 62 |
|
| 63 | + AuthTokenType(AuthTokenPermission... permissions) |
| 64 | + { |
| 65 | + this.permissions = ImmutableSet.copyOf(permissions); |
| 66 | + } |
| 67 | + |
61 | 68 | /** |
62 | 69 | * Parses the token type from the given {@code prefix}. |
63 | 70 | * @param prefix The prefix to parse. |
|
0 commit comments