Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
SecurityCache | 41 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.security.authorization.cache.internal; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.security.GroupSecurityReference; | |
26 | import org.xwiki.security.SecurityReference; | |
27 | import org.xwiki.security.UserSecurityReference; | |
28 | import org.xwiki.security.authorization.SecurityAccessEntry; | |
29 | import org.xwiki.security.authorization.SecurityRuleEntry; | |
30 | import org.xwiki.security.authorization.cache.ConflictingInsertionException; | |
31 | import org.xwiki.security.authorization.cache.ParentEntryEvictedException; | |
32 | import org.xwiki.security.authorization.cache.SecurityShadowEntry; | |
33 | ||
34 | /** | |
35 | * A cache for fast access right rules checking. | |
36 | * | |
37 | * @version $Id: fef1f93892d9db9dc381fe66e18a8776b45f556a $ | |
38 | * @since 4.0M2 | |
39 | */ | |
40 | @Role | |
41 | public interface SecurityCache extends org.xwiki.security.authorization.cache.SecurityCache | |
42 | { | |
43 | /** | |
44 | * Add an entry to this cache. | |
45 | * @param entry The rule entry to add. | |
46 | * @throws org.xwiki.security.authorization.cache.ParentEntryEvictedException when the parent entry of | |
47 | * this entry was evicted before this insertion. Since all | |
48 | * entries, except wiki-entries, must have a parent cached, the | |
49 | * {@link org.xwiki.security.authorization.cache.SecurityCacheLoader} must restart its load attempt. | |
50 | * @throws org.xwiki.security.authorization.cache.ConflictingInsertionException when another thread have | |
51 | * inserted this entry, but with a different content. | |
52 | */ | |
53 | void add(SecurityRuleEntry entry) | |
54 | throws ParentEntryEvictedException, ConflictingInsertionException; | |
55 | ||
56 | /** | |
57 | * Add an entry to this cache. | |
58 | * @param entry The access entry to add. | |
59 | * @throws ParentEntryEvictedException when the parent entry of | |
60 | * this entry was evicted before this insertion. Since all | |
61 | * entries, except wiki-entries, must have a parent cached, the | |
62 | * {@link org.xwiki.security.authorization.cache.SecurityCacheLoader} must restart its load attempt. | |
63 | * @throws ConflictingInsertionException when another thread have | |
64 | * inserted this entry, but with a different content. | |
65 | */ | |
66 | void add(SecurityAccessEntry entry) | |
67 | throws ParentEntryEvictedException, ConflictingInsertionException; | |
68 | ||
69 | /** | |
70 | * Add an entry for access to a local wiki entity by a global user. | |
71 | * @param entry The access entry to add. | |
72 | * @param wiki The sub-wiki context of this entry | |
73 | * @throws ParentEntryEvictedException when the parent entry of | |
74 | * this entry was evicted before this insertion. Since all | |
75 | * entries, except wiki-entries, must have a parent cached, the | |
76 | * {@link org.xwiki.security.authorization.cache.SecurityCacheLoader} must restart its load attempt. | |
77 | * @throws ConflictingInsertionException when another thread have | |
78 | * inserted this entry, but with a different content. | |
79 | * | |
80 | * @since 5.0M2 | |
81 | */ | |
82 | void add(SecurityAccessEntry entry, SecurityReference wiki) | |
83 | throws ParentEntryEvictedException, ConflictingInsertionException; | |
84 | ||
85 | /** | |
86 | * Add a user/group entry to this cache. | |
87 | * | |
88 | * @param entry The user/group entry to insert. | |
89 | * @param groups Local groups references that this user/group is a member. | |
90 | * @exception ParentEntryEvictedException when the parent entry of | |
91 | * this entry was evicted before this insertion. Since all | |
92 | * entries, except wiki-entries, must have a parent cached, the | |
93 | * {@link org.xwiki.security.authorization.cache.SecurityCacheLoader} must restart its load attempt. | |
94 | * @throws ConflictingInsertionException when another thread have | |
95 | * inserted this entry, but with a different content. | |
96 | */ | |
97 | void add(SecurityRuleEntry entry, Collection<GroupSecurityReference> groups) | |
98 | throws ParentEntryEvictedException, ConflictingInsertionException; | |
99 | ||
100 | /** | |
101 | * Add a shadow user/group entry to this cache. | |
102 | * | |
103 | * @param entry The user entry to insert. | |
104 | * @param groups Local group references that this user/group is a member. | |
105 | * @exception ParentEntryEvictedException when the parent entry of | |
106 | * this entry was evicted before this insertion. Since all | |
107 | * entries, except wiki-entries, must have a parent cached, the | |
108 | * {@link org.xwiki.security.authorization.cache.SecurityCacheLoader} must restart its load attempt. | |
109 | * @throws ConflictingInsertionException when another thread have | |
110 | * inserted this entry, but with a different content. | |
111 | * | |
112 | * @since 5.0M2 | |
113 | */ | |
114 | void add(SecurityShadowEntry entry, Collection<GroupSecurityReference> groups) | |
115 | throws ParentEntryEvictedException, ConflictingInsertionException; | |
116 | ||
117 | /** | |
118 | * Get immediate groups where the user/group is a member (directly in its wiki). | |
119 | * | |
120 | * @param user reference to a user/group | |
121 | * @return the list of immediate groups where the user is a member or null if the information is not in the cache | |
122 | * | |
123 | * @since 7.1.5 | |
124 | * @since 7.4.5 | |
125 | * @since 8.2.2 | |
126 | * @since 8.3RC1 | |
127 | */ | |
128 | Collection<GroupSecurityReference> getImmediateGroupsFor(UserSecurityReference user); | |
129 | ||
130 | /** | |
131 | * Get all groups where the user/group is a member (directly, or indirectly including relation due to global groups | |
132 | * members of local ones). | |
133 | * | |
134 | * If the user is global and entityWiki is not null: | |
135 | * - returns the local groups (from entityWiki) and the global groups where the user is, directly or indirectly | |
136 | * If entityWiki is null: | |
137 | * - returns the groups from the wiki of the user where the user is, directly or indirectly | |
138 | * If the cache does not contain the needed information:: | |
139 | * - returns null | |
140 | * | |
141 | * @param user reference to a user/group | |
142 | * @param entityWiki the wiki where to look for the groups (null if the wiki is the same than the user's wiki) | |
143 | * @return the list of all groups where the user is a member or null if the information is not in the cache yet | |
144 | * | |
145 | * @since 6.4.3 | |
146 | * @since 7.0RC1 | |
147 | */ | |
148 | Collection<GroupSecurityReference> getGroupsFor(UserSecurityReference user, SecurityReference entityWiki); | |
149 | } |