| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| XWikiGroupService | 36 | 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 com.xpn.xwiki.user.api; | |
| 21 | ||
| 22 | import java.util.Collection; | |
| 23 | import java.util.List; | |
| 24 | ||
| 25 | import org.xwiki.model.reference.DocumentReference; | |
| 26 | ||
| 27 | import com.xpn.xwiki.XWiki; | |
| 28 | import com.xpn.xwiki.XWikiContext; | |
| 29 | import com.xpn.xwiki.XWikiException; | |
| 30 | ||
| 31 | /** | |
| 32 | * Interface giving access to users and groups management. | |
| 33 | * | |
| 34 | * @version $Id: 296aa38f4cf7791504bf20b8d53170e50b9430e3 $ | |
| 35 | */ | |
| 36 | public interface XWikiGroupService | |
| 37 | { | |
| 38 | void init(XWiki xwiki, XWikiContext context) throws XWikiException; | |
| 39 | ||
| 40 | void initCache(XWikiContext context) throws XWikiException; | |
| 41 | ||
| 42 | void initCache(int iCapacity, XWikiContext context) throws XWikiException; | |
| 43 | ||
| 44 | void flushCache(); | |
| 45 | ||
| 46 | /** | |
| 47 | * @deprecated Use {@link #getAllGroupsNamesForMember(String, int, int, XWikiContext)}. | |
| 48 | */ | |
| 49 | @Deprecated | |
| 50 | Collection<String> listGroupsForUser(String username, XWikiContext context) throws XWikiException; | |
| 51 | ||
| 52 | /** | |
| 53 | * @deprecated should never be used ! There is a listener taking care of that automatically. | |
| 54 | */ | |
| 55 | @Deprecated | |
| 56 | void addUserToGroup(String user, String database, String group, XWikiContext context) throws XWikiException; | |
| 57 | ||
| 58 | /** | |
| 59 | * Remove user or group name from all groups. | |
| 60 | * | |
| 61 | * @param userOrGroupWiki the name of the wiki of the member. | |
| 62 | * @param userOrGroupSpace the name of the space of the member. | |
| 63 | * @param userOrGroupName the name of the member. | |
| 64 | * @param context the XWiki context. | |
| 65 | * @throws XWikiException error when browsing groups. | |
| 66 | * @since 1.1.2 | |
| 67 | * @since 1.2M2 | |
| 68 | */ | |
| 69 | void removeUserOrGroupFromAllGroups(String userOrGroupWiki, String userOrGroupSpace, String userOrGroupName, | |
| 70 | XWikiContext context) throws XWikiException; | |
| 71 | ||
| 72 | /** | |
| 73 | * @deprecated Use {@link #getAllMembersNamesForGroup(String, int, int, XWikiContext)}. | |
| 74 | */ | |
| 75 | @Deprecated | |
| 76 | List<String> listMemberForGroup(String s, XWikiContext context) throws XWikiException; | |
| 77 | ||
| 78 | /** | |
| 79 | * @deprecated Use {@link #getAllMatchedGroups(Object[][], boolean, int, int, Object[][], XWikiContext)}. | |
| 80 | */ | |
| 81 | @Deprecated | |
| 82 | List<String> listAllGroups(XWikiContext context) throws XWikiException; | |
| 83 | ||
| 84 | /** | |
| 85 | * Search for all users with provided constraints and in a provided order. | |
| 86 | * | |
| 87 | * @param matchFields the field to math with values. It is a table of table with : | |
| 88 | * <ul> | |
| 89 | * <li>fiedname : the name of the field</li> | |
| 90 | * <li>fieldtype : for example StringProperty. If null the field is considered as document field</li> | |
| 91 | * <li>pattern matching : based on HQL "like" command</li> | |
| 92 | * </ul> | |
| 93 | * @param withdetails indicate if a {@link List} containing {@link String} names is returned or {@link List} | |
| 94 | * containing {@link com.xpn.xwiki.doc.XWikiDocument}. | |
| 95 | * @param nb the maximum number of results to return. Infinite if 0. | |
| 96 | * @param start the index of the first found user to return. | |
| 97 | * @param order the fields to order from. It is a table of table with : | |
| 98 | * <ul> | |
| 99 | * <li>fieldname : the name of the field</li> | |
| 100 | * <li>fieldtype : for example StringProperty. If null the field is considered as document field</li> | |
| 101 | * <li>asc : a Boolean, if true the order is ascendent</li> | |
| 102 | * </ul> | |
| 103 | * @param context the {@link XWikiContext}. | |
| 104 | * @return the list of users. | |
| 105 | * @throws XWikiException error when getting users. | |
| 106 | * @since 1.1.2 | |
| 107 | * @since 1.2M2 | |
| 108 | */ | |
| 109 | List<?> getAllMatchedUsers(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order, | |
| 110 | XWikiContext context) throws XWikiException; | |
| 111 | ||
| 112 | /** | |
| 113 | * Search for all groups with provided constraints and in a provided order. | |
| 114 | * | |
| 115 | * @param matchFields the field to math with values. It is a table of table with : | |
| 116 | * <ul> | |
| 117 | * <li>fiedname : the name of the field</li> | |
| 118 | * <li>fieldtype : for example StringProperty. If null the field is considered as document field</li> | |
| 119 | * <li>pattern matching : based on HQL "like" command</li> | |
| 120 | * </ul> | |
| 121 | * . | |
| 122 | * @param withdetails indicate if a {@link List} containing {@link String} names is returned or {@link List} | |
| 123 | * containing {@link com.xpn.xwiki.doc.XWikiDocument}. | |
| 124 | * @param nb the maximum number of result to return. Infinite if 0. | |
| 125 | * @param start the index of the first found group to return. | |
| 126 | * @param order the field to order from. It is a table of table with : | |
| 127 | * <ul> | |
| 128 | * <li>fieldname : the name of the field</li> | |
| 129 | * <li>fieldtype : for example StringProperty. If null the field is considered as document field</li> | |
| 130 | * <li>asc : a Boolean, if true the order is ascendent</li> | |
| 131 | * </ul> | |
| 132 | * @param context the {@link XWikiContext}. | |
| 133 | * @return the list of groups. | |
| 134 | * @throws XWikiException error when getting groups. | |
| 135 | * @since 1.1.2 | |
| 136 | * @since 1.2M2 | |
| 137 | */ | |
| 138 | List<?> getAllMatchedGroups(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order, | |
| 139 | XWikiContext context) throws XWikiException; | |
| 140 | ||
| 141 | /** | |
| 142 | * Return number of users with provided constraints. | |
| 143 | * | |
| 144 | * @param matchFields the field to math with values. It is a table of table with : | |
| 145 | * <ul> | |
| 146 | * <li>fiedname : the name of the field</li> | |
| 147 | * <li>fieldtype : for example StringProperty. If null the field is considered as document field</li> | |
| 148 | * <li>pattern matching : based on HQL "like" command</li> | |
| 149 | * </ul> | |
| 150 | * . | |
| 151 | * @param context the {@link XWikiContext}. | |
| 152 | * @return the of found users. | |
| 153 | * @throws XWikiException error when getting number of users. | |
| 154 | * @since 1.1.2 | |
| 155 | * @since 1.2M2 | |
| 156 | */ | |
| 157 | int countAllMatchedUsers(Object[][] matchFields, XWikiContext context) throws XWikiException; | |
| 158 | ||
| 159 | /** | |
| 160 | * Return number of groups with provided constraints. | |
| 161 | * | |
| 162 | * @param matchFields the field to math with values. It is a table of table with : | |
| 163 | * <ul> | |
| 164 | * <li>fiedname : the name of the field</li> | |
| 165 | * <li>fieldtype : for example StringProperty. If null the field is considered as document field</li> | |
| 166 | * <li>pattern matching : based on HQL "like" command</li> | |
| 167 | * </ul> | |
| 168 | * . | |
| 169 | * @param context the {@link XWikiContext}. | |
| 170 | * @return the of found groups. | |
| 171 | * @throws XWikiException error when getting number of groups. | |
| 172 | * @since 1.1.2 | |
| 173 | * @since 1.2M2 | |
| 174 | */ | |
| 175 | int countAllMatchedGroups(Object[][] matchFields, XWikiContext context) throws XWikiException; | |
| 176 | ||
| 177 | /** | |
| 178 | * Get all groups containing provided member in the provided member wiki. | |
| 179 | * | |
| 180 | * @param member the name of the member (user or group). | |
| 181 | * @param nb the maximum number of result to return. | |
| 182 | * @param start the index of the first found member to return. | |
| 183 | * @param context the XWiki context. | |
| 184 | * @return the {@link Collection} of {@link String} containing group name. | |
| 185 | * @throws XWikiException error when browsing groups. | |
| 186 | * @since 1.1.2 | |
| 187 | * @since 1.2M2 | |
| 188 | */ | |
| 189 | Collection<String> getAllGroupsNamesForMember(String member, int nb, int start, XWikiContext context) | |
| 190 | throws XWikiException; | |
| 191 | ||
| 192 | /** | |
| 193 | * Get all groups containing provided member in the current wiki. | |
| 194 | * | |
| 195 | * @param memberReference the member. Can be either user or group. | |
| 196 | * @param limit the maximum number of result to return. | |
| 197 | * @param offset the index of the first found member to return. | |
| 198 | * @param context the XWiki context. | |
| 199 | * @return the {@link Collection} of {@link DocumentReference} containing representing groups. | |
| 200 | * @throws XWikiException error when browsing groups. | |
| 201 | * @since 2.4M2 | |
| 202 | */ | |
| 203 | Collection<DocumentReference> getAllGroupsReferencesForMember(DocumentReference memberReference, int limit, | |
| 204 | int offset, XWikiContext context) throws XWikiException; | |
| 205 | ||
| 206 | /** | |
| 207 | * Get all members provided group contains. | |
| 208 | * | |
| 209 | * @param group the name of the group. | |
| 210 | * @param nb the maximum number of result to return. | |
| 211 | * @param start the index of the first found user to return. | |
| 212 | * @param context the XWiki context. | |
| 213 | * @return the {@link Collection} of {@link String} containing member name. | |
| 214 | * @throws XWikiException error when browsing groups. | |
| 215 | * @since 1.1.2 | |
| 216 | * @since 1.2M2 | |
| 217 | */ | |
| 218 | Collection<String> getAllMembersNamesForGroup(String group, int nb, int start, XWikiContext context) | |
| 219 | throws XWikiException; | |
| 220 | ||
| 221 | /** | |
| 222 | * Get members of provided group. | |
| 223 | * | |
| 224 | * @param group the group. | |
| 225 | * @param matchField a string to search in result to filter. | |
| 226 | * @param nb the maximum number of result to return. | |
| 227 | * @param start the index of the first found user to return. | |
| 228 | * @param orderAsc if true, the result is ordered ascendent, if false it descendant. If null no order is applied. | |
| 229 | * @param context the XWiki context. | |
| 230 | * @return the {@link Collection} of {@link String} containing member name. | |
| 231 | * @throws XWikiException error when browsing groups. | |
| 232 | * @since 1.6M1 | |
| 233 | */ | |
| 234 | Collection<String> getAllMatchedMembersNamesForGroup(String group, String matchField, int nb, int start, | |
| 235 | Boolean orderAsc, XWikiContext context) throws XWikiException; | |
| 236 | ||
| 237 | /** | |
| 238 | * Return the number of groups containing provided member. | |
| 239 | * | |
| 240 | * @param member the name of the member (user or group). | |
| 241 | * @param context the XWiki context. | |
| 242 | * @return the number of groups. | |
| 243 | * @throws XWikiException error when getting number of users. | |
| 244 | * @since 1.1.2 | |
| 245 | * @since 1.2M2 | |
| 246 | */ | |
| 247 | int countAllGroupsNamesForMember(String member, XWikiContext context) throws XWikiException; | |
| 248 | ||
| 249 | /** | |
| 250 | * Return the number of members provided group contains. | |
| 251 | * | |
| 252 | * @param group the name of the group. | |
| 253 | * @param context the XWiki context. | |
| 254 | * @return the number of members. | |
| 255 | * @throws XWikiException error when getting number of groups. | |
| 256 | * @since 1.1.2 | |
| 257 | * @since 1.2M2 | |
| 258 | */ | |
| 259 | int countAllMembersNamesForGroup(String group, XWikiContext context) throws XWikiException; | |
| 260 | } |