1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.security.auth.PrincipalException;
20  import com.liferay.portal.security.permission.PermissionChecker;
21  import com.liferay.portal.service.base.UserGroupGroupRoleServiceBaseImpl;
22  
23  /**
24   * <a href="UserGroupGroupRoleServiceImpl.java.html"><b><i>View Source</i></b>
25   * </a>
26   *
27   * @author Brett Swaim
28   */
29  public class UserGroupGroupRoleServiceImpl
30      extends UserGroupGroupRoleServiceBaseImpl {
31  
32      public void addUserGroupGroupRoles(
33              long userGroupId, long groupId, long[] roleIds)
34          throws PortalException, SystemException {
35  
36          PermissionChecker permissionChecker = getPermissionChecker();
37  
38          if (!permissionChecker.isCommunityOwner(groupId)) {
39              throw new PrincipalException();
40          }
41  
42          userGroupGroupRoleLocalService.addUserGroupGroupRoles(
43              userGroupId, groupId, roleIds);
44      }
45  
46      public void addUserGroupGroupRoles(
47              long[] userGroupIds, long groupId, long roleId)
48          throws PortalException, SystemException {
49  
50          PermissionChecker permissionChecker = getPermissionChecker();
51  
52          if (!permissionChecker.isCommunityOwner(groupId)) {
53              throw new PrincipalException();
54          }
55  
56          userGroupGroupRoleLocalService.addUserGroupGroupRoles(
57              userGroupIds, groupId, roleId);
58      }
59  
60      public void deleteUserGroupGroupRoles(
61              long userGroupId, long groupId, long[] roleIds)
62          throws PortalException, SystemException {
63  
64          PermissionChecker permissionChecker = getPermissionChecker();
65  
66          if (!permissionChecker.isCommunityOwner(groupId)) {
67              throw new PrincipalException();
68          }
69  
70          userGroupGroupRoleLocalService.deleteUserGroupGroupRoles(
71              userGroupId, groupId, roleIds);
72      }
73  
74      public void deleteUserGroupGroupRoles(
75              long[] userGroupIds, long groupId, long roleId)
76          throws PortalException, SystemException {
77  
78          PermissionChecker permissionChecker = getPermissionChecker();
79  
80          if (!permissionChecker.isCommunityOwner(groupId)) {
81              throw new PrincipalException();
82          }
83  
84          userGroupGroupRoleLocalService.deleteUserGroupGroupRoles(
85              userGroupIds, groupId, roleId);
86      }
87  
88  }