001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.impl;
016    
017    import com.liferay.portal.DuplicateUserGroupException;
018    import com.liferay.portal.NoSuchUserGroupException;
019    import com.liferay.portal.RequiredUserGroupException;
020    import com.liferay.portal.UserGroupNameException;
021    import com.liferay.portal.kernel.exception.PortalException;
022    import com.liferay.portal.kernel.exception.SystemException;
023    import com.liferay.portal.kernel.lar.PortletDataHandlerKeys;
024    import com.liferay.portal.kernel.lar.UserIdStrategy;
025    import com.liferay.portal.kernel.search.Indexer;
026    import com.liferay.portal.kernel.search.IndexerRegistryUtil;
027    import com.liferay.portal.kernel.util.CharPool;
028    import com.liferay.portal.kernel.util.OrderByComparator;
029    import com.liferay.portal.kernel.util.Validator;
030    import com.liferay.portal.kernel.workflow.WorkflowConstants;
031    import com.liferay.portal.model.Group;
032    import com.liferay.portal.model.ResourceConstants;
033    import com.liferay.portal.model.Team;
034    import com.liferay.portal.model.User;
035    import com.liferay.portal.model.UserGroup;
036    import com.liferay.portal.model.UserGroupConstants;
037    import com.liferay.portal.security.ldap.LDAPUserGroupTransactionThreadLocal;
038    import com.liferay.portal.security.permission.PermissionCacheUtil;
039    import com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl;
040    import com.liferay.portal.util.PropsValues;
041    
042    import java.io.File;
043    
044    import java.util.ArrayList;
045    import java.util.LinkedHashMap;
046    import java.util.List;
047    import java.util.Map;
048    
049    /**
050     * The implementation of the user group local service.
051     *
052     * @author Charles May
053     */
054    public class UserGroupLocalServiceImpl extends UserGroupLocalServiceBaseImpl {
055    
056            /**
057             * Adds the user groups to the group.
058             *
059             * @param  groupId the primary key of the group
060             * @param  userGroupIds the primary keys of the user groups
061             * @throws SystemException if a system exception occurred
062             */
063            public void addGroupUserGroups(long groupId, long[] userGroupIds)
064                    throws SystemException {
065    
066                    groupPersistence.addUserGroups(groupId, userGroupIds);
067    
068                    PermissionCacheUtil.clearCache();
069            }
070    
071            /**
072             * Adds the user groups to the team.
073             *
074             * @param  teamId the primary key of the team
075             * @param  userGroupIds the primary keys of the user groups
076             * @throws SystemException if a system exception occurred
077             */
078            public void addTeamUserGroups(long teamId, long[] userGroupIds)
079                    throws SystemException {
080    
081                    teamPersistence.addUserGroups(teamId, userGroupIds);
082    
083                    PermissionCacheUtil.clearCache();
084            }
085    
086            /**
087             * Adds a user group.
088             *
089             * <p>
090             * This method handles the creation and bookkeeping of the user group,
091             * including its resources, metadata, and internal data structures. It is
092             * not necessary to make subsequent calls to setup default groups and
093             * resources for the user group.
094             * </p>
095             *
096             * @param  userId the primary key of the user
097             * @param  companyId the primary key of the user group's company
098             * @param  name the user group's name
099             * @param  description the user group's description
100             * @return the user group
101             * @throws PortalException if the user group's information was invalid
102             * @throws SystemException if a system exception occurred
103             */
104            public UserGroup addUserGroup(
105                            long userId, long companyId, String name, String description)
106                    throws PortalException, SystemException {
107    
108                    // User Group
109    
110                    validate(0, companyId, name);
111    
112                    long userGroupId = counterLocalService.increment();
113    
114                    UserGroup userGroup = userGroupPersistence.create(userGroupId);
115    
116                    userGroup.setCompanyId(companyId);
117                    userGroup.setParentUserGroupId(
118                            UserGroupConstants.DEFAULT_PARENT_USER_GROUP_ID);
119                    userGroup.setName(name);
120                    userGroup.setDescription(description);
121                    userGroup.setAddedByLDAPImport(
122                            LDAPUserGroupTransactionThreadLocal.isOriginatesFromLDAP());
123    
124                    userGroupPersistence.update(userGroup, false);
125    
126                    // Group
127    
128                    groupLocalService.addGroup(
129                            userId, UserGroup.class.getName(), userGroup.getUserGroupId(),
130                            String.valueOf(userGroupId), null, 0, null, false, true, null);
131    
132                    // Resources
133    
134                    resourceLocalService.addResources(
135                            companyId, 0, userId, UserGroup.class.getName(),
136                            userGroup.getUserGroupId(), false, false, false);
137    
138                    return userGroup;
139            }
140    
141            /**
142             * Clears all associations between the user and its user groups and clears
143             * the permissions cache.
144             *
145             * <p>
146             * This method is called from {@link #deleteUserGroup(UserGroup)}.
147             * </p>
148             *
149             * @param  userId the primary key of the user
150             * @throws SystemException if a system exception occurred
151             */
152            public void clearUserUserGroups(long userId) throws SystemException {
153                    userPersistence.clearUserGroups(userId);
154    
155                    PermissionCacheUtil.clearCache();
156            }
157    
158            /**
159             * Copies the user group's layouts to the users who are not already members
160             * of the user group.
161             *
162             * @param      userGroupId the primary key of the user group
163             * @param      userIds the primary keys of the users
164             * @throws     PortalException if any one of the users could not be found or
165             *             if a portal exception occurred
166             * @throws     SystemException if a system exception occurred
167             * @deprecated
168             */
169            public void copyUserGroupLayouts(long userGroupId, long userIds[])
170                    throws PortalException, SystemException {
171    
172                    Map<String, String[]> parameterMap = getLayoutTemplatesParameters();
173    
174                    File[] files = exportLayouts(userGroupId, parameterMap);
175    
176                    try {
177                            for (long userId : userIds) {
178                                    if (!userGroupPersistence.containsUser(userGroupId, userId)) {
179                                            importLayouts(userId, parameterMap, files[0], files[1]);
180                                    }
181                            }
182                    }
183                    finally {
184                            if (files[0] != null) {
185                                    files[0].delete();
186                            }
187    
188                            if (files[1] != null) {
189                                    files[1].delete();
190                            }
191                    }
192            }
193    
194            /**
195             * Copies the user groups' layouts to the user.
196             *
197             * @param      userGroupIds the primary keys of the user groups
198             * @param      userId the primary key of the user
199             * @throws     PortalException if a user with the primary key could not be
200             *             found or if a portal exception occurred
201             * @throws     SystemException if a system exception occurred
202             * @deprecated
203             */
204            public void copyUserGroupLayouts(long userGroupIds[], long userId)
205                    throws PortalException, SystemException {
206    
207                    for (long userGroupId : userGroupIds) {
208                            if (!userGroupPersistence.containsUser(userGroupId, userId)) {
209                                    copyUserGroupLayouts(userGroupId, userId);
210                            }
211                    }
212            }
213    
214            /**
215             * Copies the user group's layout to the user.
216             *
217             * @param      userGroupId the primary key of the user group
218             * @param      userId the primary key of the user
219             * @throws     PortalException if a user with the primary key could not be
220             *             found or if a portal exception occurred
221             * @throws     SystemException if a system exception occurred
222             * @deprecated
223             */
224            public void copyUserGroupLayouts(long userGroupId, long userId)
225                    throws PortalException, SystemException {
226    
227                    Map<String, String[]> parameterMap = getLayoutTemplatesParameters();
228    
229                    File[] files = exportLayouts(userGroupId, parameterMap);
230    
231                    try {
232                            importLayouts(userId, parameterMap, files[0], files[1]);
233                    }
234                    finally {
235                            if (files[0] != null) {
236                                    files[0].delete();
237                            }
238    
239                            if (files[1] != null) {
240                                    files[1].delete();
241                            }
242                    }
243            }
244    
245            /**
246             * Deletes the user group.
247             *
248             * @param  userGroupId the primary key of the user group
249             * @throws PortalException if a user group with the primary key could not be
250             *         found or if the user group had a workflow in approved status
251             * @throws SystemException if a system exception occurred
252             */
253            @Override
254            public UserGroup deleteUserGroup(long userGroupId)
255                    throws PortalException, SystemException {
256    
257                    UserGroup userGroup = userGroupPersistence.findByPrimaryKey(
258                            userGroupId);
259    
260                    return deleteUserGroup(userGroup);
261            }
262    
263            /**
264             * Deletes the user group.
265             *
266             * @param  userGroup the user group
267             * @throws PortalException if the organization had a workflow in approved
268             *         status
269             * @throws SystemException if a system exception occurred
270             */
271            @Override
272            public UserGroup deleteUserGroup(UserGroup userGroup)
273                    throws PortalException, SystemException {
274    
275                    int count = userLocalService.getUserGroupUsersCount(
276                            userGroup.getUserGroupId(), WorkflowConstants.STATUS_APPROVED);
277    
278                    if (count > 0) {
279                            throw new RequiredUserGroupException();
280                    }
281    
282                    // Users
283    
284                    clearUserUserGroups(userGroup.getUserGroupId());
285    
286                    // Group
287    
288                    Group group = userGroup.getGroup();
289    
290                    groupLocalService.deleteGroup(group);
291    
292                    // User group roles
293    
294                    userGroupGroupRoleLocalService.deleteUserGroupGroupRolesByUserGroupId(
295                            userGroup.getUserGroupId());
296    
297                    // Resources
298    
299                    resourceLocalService.deleteResource(
300                            userGroup.getCompanyId(), UserGroup.class.getName(),
301                            ResourceConstants.SCOPE_INDIVIDUAL, userGroup.getUserGroupId());
302    
303                    // User group
304    
305                    userGroupPersistence.remove(userGroup);
306    
307                    // Permission cache
308    
309                    PermissionCacheUtil.clearCache();
310    
311                    return userGroup;
312            }
313    
314            /**
315             * Returns the user group with the name.
316             *
317             * @param  companyId the primary key of the user group's company
318             * @param  name the user group's name
319             * @return Returns the user group with the name
320             * @throws PortalException if a user group with the name could not be found
321             * @throws SystemException if a system exception occurred
322             */
323            public UserGroup getUserGroup(long companyId, String name)
324                    throws PortalException, SystemException {
325    
326                    return userGroupPersistence.findByC_N(companyId, name);
327            }
328    
329            /**
330             * Returns all the user groups belonging to the company.
331             *
332             * @param  companyId the primary key of the user groups' company
333             * @return the user groups belonging to the company
334             * @throws SystemException if a system exception occurred
335             */
336            public List<UserGroup> getUserGroups(long companyId)
337                    throws SystemException {
338    
339                    return userGroupPersistence.findByCompanyId(companyId);
340            }
341    
342            /**
343             * Returns all the user groups with the primary keys.
344             *
345             * @param  userGroupIds the primary keys of the user groups
346             * @return the user groups with the primary keys
347             * @throws PortalException if any one of the user groups could not be found
348             * @throws SystemException if a system exception occurred
349             */
350            public List<UserGroup> getUserGroups(long[] userGroupIds)
351                    throws PortalException, SystemException {
352    
353                    List<UserGroup> userGroups = new ArrayList<UserGroup>(
354                            userGroupIds.length);
355    
356                    for (long userGroupId : userGroupIds) {
357                            UserGroup userGroup = getUserGroup(userGroupId);
358    
359                            userGroups.add(userGroup);
360                    }
361    
362                    return userGroups;
363            }
364    
365            /**
366             * Returns all the user groups to which the user belongs.
367             *
368             * @param  userId the primary key of the user
369             * @return the user groups to which the user belongs
370             * @throws SystemException if a system exception occurred
371             */
372            public List<UserGroup> getUserUserGroups(long userId)
373                    throws SystemException {
374    
375                    return userPersistence.getUserGroups(userId);
376            }
377    
378            /**
379             * Returns <code>true</code> if the user group is associated with the group.
380             *
381             * @param  groupId the primary key of the group
382             * @param  userGroupId the primary key of the user group
383             * @return <code>true</code> if the user group belongs to the group;
384             *         <code>false</code> otherwise
385             * @throws SystemException if a system exception occurred
386             */
387            public boolean hasGroupUserGroup(long groupId, long userGroupId)
388                    throws SystemException {
389    
390                    return groupPersistence.containsUserGroup(groupId, userGroupId);
391            }
392    
393            /**
394             * Returns <code>true</code> if the user group belongs to the team.
395             *
396             * @param  teamId the primary key of the team
397             * @param  userGroupId the primary key of the user group
398             * @return <code>true</code> if the user group belongs to the team;
399             *         <code>false</code> otherwise
400             * @throws SystemException if a system exception occurred
401             */
402            public boolean hasTeamUserGroup(long teamId, long userGroupId)
403                    throws SystemException {
404    
405                    return teamPersistence.containsUserGroup(teamId, userGroupId);
406            }
407    
408            public List<UserGroup> search(
409                            long companyId, String keywords,
410                            LinkedHashMap<String, Object> params, int start, int end,
411                            OrderByComparator obc)
412                    throws SystemException {
413    
414                    return userGroupFinder.findByKeywords(
415                            companyId, keywords, params, start, end, obc);
416            }
417    
418            /**
419             * Returns an ordered range of all the user groups that match the name and
420             * description.
421             *
422             * <p>
423             * Useful when paginating results. Returns a maximum of <code>end -
424             * start</code> instances. <code>start</code> and <code>end</code> are not
425             * primary keys, they are indexes in the result set. Thus, <code>0</code>
426             * refers to the first result in the set. Setting both <code>start</code>
427             * and <code>end</code> to {@link
428             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
429             * result set.
430             * </p>
431             *
432             * @param  companyId the primary key of the user group's company
433             * @param  name the user group's name (optionally <code>null</code>)
434             * @param  description the user group's description (optionally
435             *         <code>null</code>)
436             * @param  params the finder params (optionally <code>null</code>). For more
437             *         information see {@link
438             *         com.liferay.portal.service.persistence.UserGroupFinder}
439             * @param  start the lower bound of the range of user groups to return
440             * @param  end the upper bound of the range of user groups to return (not
441             *         inclusive)
442             * @param  obc the comparator to order the user groups (optionally
443             *         <code>null</code>)
444             * @return the matching user groups ordered by comparator <code>obc</code>
445             * @throws SystemException if a system exception occurred
446             * @see    com.liferay.portal.service.persistence.UserGroupFinder
447             */
448            public List<UserGroup> search(
449                            long companyId, String name, String description,
450                            LinkedHashMap<String, Object> params, int start, int end,
451                            OrderByComparator obc)
452                    throws SystemException {
453    
454                    return userGroupFinder.findByC_N_D(
455                            companyId, name, description, params, false, start, end, obc);
456            }
457    
458            public int searchCount(
459                            long companyId, String keywords,
460                            LinkedHashMap<String, Object> params)
461                    throws SystemException {
462    
463                    return userGroupFinder.countByKeywords(companyId, keywords, params);
464            }
465    
466            /**
467             * Returns the number of user groups that match the name and description.
468             *
469             * @param  companyId the primary key of the user group's company
470             * @param  name the user group's name (optionally <code>null</code>)
471             * @param  description the user group's description (optionally
472             *         <code>null</code>)
473             * @param  params the finder params (optionally <code>null</code>). For more
474             *         information see {@link
475             *         com.liferay.portal.service.persistence.UserGroupFinder}
476             * @return the number of matching user groups
477             * @throws SystemException if a system exception occurred
478             * @see    com.liferay.portal.service.persistence.UserGroupFinder
479             */
480            public int searchCount(
481                            long companyId, String name, String description,
482                            LinkedHashMap<String, Object> params)
483                    throws SystemException {
484    
485                    return userGroupFinder.countByC_N_D(
486                            companyId, name, description, params, false);
487            }
488    
489            /**
490             * Sets the user groups associated with the user copying the user group
491             * layouts and removing and adding user group associations for the user as
492             * necessary.
493             *
494             * @param  userId the primary key of the user
495             * @param  userGroupIds the primary keys of the user groups
496             * @throws PortalException if a portal exception occurred
497             * @throws SystemException if a system exception occurred
498             */
499            public void setUserUserGroups(long userId, long[] userGroupIds)
500                    throws PortalException, SystemException {
501    
502                    copyUserGroupLayouts(userGroupIds, userId);
503    
504                    userPersistence.setUserGroups(userId, userGroupIds);
505    
506                    Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
507    
508                    indexer.reindex(userId);
509    
510                    PermissionCacheUtil.clearCache();
511            }
512    
513            /**
514             * Removes the user groups from the group.
515             *
516             * @param  groupId the primary key of the group
517             * @param  userGroupIds the primary keys of the user groups
518             * @throws SystemException if a system exception occurred
519             */
520            public void unsetGroupUserGroups(long groupId, long[] userGroupIds)
521                    throws SystemException {
522    
523                    List<Team> teams = teamPersistence.findByGroupId(groupId);
524    
525                    for (Team team : teams) {
526                            teamPersistence.removeUserGroups(team.getTeamId(), userGroupIds);
527                    }
528    
529                    userGroupGroupRoleLocalService.deleteUserGroupGroupRoles(
530                            userGroupIds, groupId);
531    
532                    groupPersistence.removeUserGroups(groupId, userGroupIds);
533    
534                    PermissionCacheUtil.clearCache();
535            }
536    
537            /**
538             * Removes the user groups from the team.
539             *
540             * @param  teamId the primary key of the team
541             * @param  userGroupIds the primary keys of the user groups
542             * @throws SystemException if a system exception occurred
543             */
544            public void unsetTeamUserGroups(long teamId, long[] userGroupIds)
545                    throws SystemException {
546    
547                    teamPersistence.removeUserGroups(teamId, userGroupIds);
548    
549                    PermissionCacheUtil.clearCache();
550            }
551    
552            /**
553             * Updates the user group.
554             *
555             * @param  companyId the primary key of the user group's company
556             * @param  userGroupId the primary key of the user group
557             * @param  name the user group's name
558             * @param  description the user group's description
559             * @return the user group
560             * @throws PortalException if a user group with the primary key could not be
561             *         found or if the new information was invalid
562             * @throws SystemException if a system exception occurred
563             */
564            public UserGroup updateUserGroup(
565                            long companyId, long userGroupId, String name, String description)
566                    throws PortalException, SystemException {
567    
568                    validate(userGroupId, companyId, name);
569    
570                    UserGroup userGroup = userGroupPersistence.findByPrimaryKey(
571                            userGroupId);
572    
573                    userGroup.setName(name);
574                    userGroup.setDescription(description);
575    
576                    userGroupPersistence.update(userGroup, false);
577    
578                    return userGroup;
579            }
580    
581            protected File[] exportLayouts(
582                            long userGroupId, Map<String, String[]> parameterMap)
583                    throws PortalException, SystemException {
584    
585                    File[] files = new File[2];
586    
587                    UserGroup userGroup = userGroupPersistence.findByPrimaryKey(
588                            userGroupId);
589    
590                    Group group = userGroup.getGroup();
591    
592                    if (userGroup.hasPrivateLayouts()) {
593                            files[0] = layoutLocalService.exportLayoutsAsFile(
594                                    group.getGroupId(), true, null, parameterMap, null, null);
595                    }
596    
597                    if (userGroup.hasPublicLayouts()) {
598                            files[1] = layoutLocalService.exportLayoutsAsFile(
599                                    group.getGroupId(), false, null, parameterMap, null, null);
600                    }
601    
602                    return files;
603            }
604    
605            protected Map<String, String[]> getLayoutTemplatesParameters() {
606                    Map<String, String[]> parameterMap =
607                            new LinkedHashMap<String, String[]>();
608    
609                    parameterMap.put(
610                            PortletDataHandlerKeys.CATEGORIES,
611                            new String[] {Boolean.TRUE.toString()});
612                    parameterMap.put(
613                            PortletDataHandlerKeys.DATA_STRATEGY,
614                            new String[] {PortletDataHandlerKeys.DATA_STRATEGY_MIRROR});
615                    parameterMap.put(
616                            PortletDataHandlerKeys.DELETE_MISSING_LAYOUTS,
617                            new String[] {Boolean.FALSE.toString()});
618                    parameterMap.put(
619                            PortletDataHandlerKeys.DELETE_PORTLET_DATA,
620                            new String[] {Boolean.FALSE.toString()});
621                    parameterMap.put(
622                            PortletDataHandlerKeys.LAYOUT_SET_SETTINGS,
623                            new String[] {Boolean.FALSE.toString()});
624                    parameterMap.put(
625                            PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE,
626                            new String[] {PortletDataHandlerKeys.
627                                    LAYOUTS_IMPORT_MODE_CREATED_FROM_PROTOTYPE});
628                    parameterMap.put(
629                            PortletDataHandlerKeys.LOGO,
630                            new String[] {Boolean.FALSE.toString()});
631                    parameterMap.put(
632                            PortletDataHandlerKeys.PERMISSIONS,
633                            new String[] {Boolean.TRUE.toString()});
634                    parameterMap.put(
635                            PortletDataHandlerKeys.PORTLET_DATA,
636                            new String[] {Boolean.TRUE.toString()});
637                    parameterMap.put(
638                            PortletDataHandlerKeys.PORTLET_DATA_ALL,
639                            new String[] {Boolean.TRUE.toString()});
640                    parameterMap.put(
641                            PortletDataHandlerKeys.PORTLET_SETUP,
642                            new String[] {Boolean.TRUE.toString()});
643                    parameterMap.put(
644                            PortletDataHandlerKeys.PORTLET_USER_PREFERENCES,
645                            new String[] {Boolean.TRUE.toString()});
646                    parameterMap.put(
647                            PortletDataHandlerKeys.PORTLETS_MERGE_MODE,
648                            new String[] {PortletDataHandlerKeys.
649                                    PORTLETS_MERGE_MODE_ADD_TO_BOTTOM});
650                    parameterMap.put(
651                            PortletDataHandlerKeys.THEME,
652                            new String[] {Boolean.FALSE.toString()});
653                    parameterMap.put(
654                            PortletDataHandlerKeys.THEME_REFERENCE,
655                            new String[] {Boolean.TRUE.toString()});
656                    parameterMap.put(
657                            PortletDataHandlerKeys.UPDATE_LAST_PUBLISH_DATE,
658                            new String[] {Boolean.FALSE.toString()});
659                    parameterMap.put(
660                            PortletDataHandlerKeys.USER_ID_STRATEGY,
661                            new String[] {UserIdStrategy.CURRENT_USER_ID});
662                    parameterMap.put(
663                            PortletDataHandlerKeys.USER_PERMISSIONS,
664                            new String[] {Boolean.FALSE.toString()});
665    
666                    return parameterMap;
667            }
668    
669            protected void importLayouts(
670                            long userId, Map<String, String[]> parameterMap,
671                            File privateLayoutsFile, File publicLayoutsFile)
672                    throws PortalException, SystemException {
673    
674                    User user = userPersistence.findByPrimaryKey(userId);
675    
676                    long groupId = user.getGroup().getGroupId();
677    
678                    if (privateLayoutsFile != null) {
679                            layoutLocalService.importLayouts(
680                                    userId, groupId, true, parameterMap, privateLayoutsFile);
681                    }
682    
683                    if (publicLayoutsFile != null) {
684                            layoutLocalService.importLayouts(
685                                    userId, groupId, false, parameterMap, publicLayoutsFile);
686                    }
687            }
688    
689            protected void validate(long userGroupId, long companyId, String name)
690                    throws PortalException, SystemException {
691    
692                    if (Validator.isNull(name) ||
693                            (name.indexOf(CharPool.COMMA) != -1) ||
694                            (name.indexOf(CharPool.STAR) != -1)) {
695    
696                            throw new UserGroupNameException();
697                    }
698    
699                    if (Validator.isNumber(name) &&
700                            !PropsValues.USER_GROUPS_NAME_ALLOW_NUMERIC) {
701    
702                            throw new UserGroupNameException();
703                    }
704    
705                    try {
706                            UserGroup userGroup = userGroupFinder.findByC_N(companyId, name);
707    
708                            if (userGroup.getUserGroupId() != userGroupId) {
709                                    throw new DuplicateUserGroupException();
710                            }
711                    }
712                    catch (NoSuchUserGroupException nsuge) {
713                    }
714            }
715    
716    }