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; 016 017 import com.liferay.portal.kernel.exception.PortalException; 018 import com.liferay.portal.kernel.exception.SystemException; 019 import com.liferay.portal.kernel.jsonwebservice.JSONWebService; 020 import com.liferay.portal.kernel.transaction.Isolation; 021 import com.liferay.portal.kernel.transaction.Propagation; 022 import com.liferay.portal.kernel.transaction.Transactional; 023 024 /** 025 * The interface for the role remote service. 026 * 027 * <p> 028 * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely. 029 * </p> 030 * 031 * @author Brian Wing Shun Chan 032 * @see RoleServiceUtil 033 * @see com.liferay.portal.service.base.RoleServiceBaseImpl 034 * @see com.liferay.portal.service.impl.RoleServiceImpl 035 * @generated 036 */ 037 @JSONWebService 038 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 039 PortalException.class, SystemException.class}) 040 public interface RoleService extends BaseService { 041 /* 042 * NOTE FOR DEVELOPERS: 043 * 044 * Never modify or reference this interface directly. Always use {@link RoleServiceUtil} to access the role remote service. Add custom service methods to {@link com.liferay.portal.service.impl.RoleServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 045 */ 046 047 /** 048 * Returns the Spring bean ID for this bean. 049 * 050 * @return the Spring bean ID for this bean 051 */ 052 public java.lang.String getBeanIdentifier(); 053 054 /** 055 * Sets the Spring bean ID for this bean. 056 * 057 * @param beanIdentifier the Spring bean ID for this bean 058 */ 059 public void setBeanIdentifier(java.lang.String beanIdentifier); 060 061 /** 062 * Adds a role. The user is reindexed after role is added. 063 * 064 * @param name the role's name 065 * @param titleMap the role's localized titles (optionally 066 <code>null</code>) 067 * @param descriptionMap the role's localized descriptions (optionally 068 <code>null</code>) 069 * @param type the role's type (optionally <code>0</code>) 070 * @return the role 071 * @throws PortalException if a user with the primary key could not be 072 found, if the user did not have permission to add roles, if the 073 class name or the role name were invalid, or if the role is a 074 duplicate 075 * @throws SystemException if a system exception occurred 076 */ 077 public com.liferay.portal.model.Role addRole(java.lang.String name, 078 java.util.Map<java.util.Locale, java.lang.String> titleMap, 079 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 080 int type) 081 throws com.liferay.portal.kernel.exception.PortalException, 082 com.liferay.portal.kernel.exception.SystemException; 083 084 /** 085 * Adds the roles to the user. The user is reindexed after the roles are 086 * added. 087 * 088 * @param userId the primary key of the user 089 * @param roleIds the primary keys of the roles 090 * @throws PortalException if a user with the primary key could not be found 091 or if the user did not have permission to assign members to one 092 of the roles 093 * @throws SystemException if a system exception occurred 094 */ 095 public void addUserRoles(long userId, long[] roleIds) 096 throws com.liferay.portal.kernel.exception.PortalException, 097 com.liferay.portal.kernel.exception.SystemException; 098 099 /** 100 * Deletes the role with the primary key and its associated permissions. 101 * 102 * @param roleId the primary key of the role 103 * @throws PortalException if the user did not have permission to delete the 104 role, if a role with the primary key could not be found, if the 105 role is a default system role, or if the role's resource could 106 not be found 107 * @throws SystemException if a system exception occurred 108 */ 109 public void deleteRole(long roleId) 110 throws com.liferay.portal.kernel.exception.PortalException, 111 com.liferay.portal.kernel.exception.SystemException; 112 113 /** 114 * Returns all the roles associated with the group. 115 * 116 * @param groupId the primary key of the group 117 * @return the roles associated with the group 118 * @throws PortalException if a portal exception occurred 119 * @throws SystemException if a system exception occurred 120 */ 121 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 122 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 123 long groupId) 124 throws com.liferay.portal.kernel.exception.PortalException, 125 com.liferay.portal.kernel.exception.SystemException; 126 127 /** 128 * Returns the role with the primary key. 129 * 130 * @param roleId the primary key of the role 131 * @return the role with the primary key 132 * @throws PortalException if a role with the primary key could not be found 133 or if the user did not have permission to view the role 134 * @throws SystemException if a system exception occurred 135 */ 136 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 137 public com.liferay.portal.model.Role getRole(long roleId) 138 throws com.liferay.portal.kernel.exception.PortalException, 139 com.liferay.portal.kernel.exception.SystemException; 140 141 /** 142 * Returns the role with the name in the company. 143 * 144 * <p> 145 * The method searches the system roles map first for default roles. If a 146 * role with the name is not found, then the method will query the database. 147 * </p> 148 * 149 * @param companyId the primary key of the company 150 * @param name the role's name 151 * @return the role with the name 152 * @throws PortalException if a role with the name could not be found in the 153 company or if the user did not have permission to view the role 154 * @throws SystemException if a system exception occurred 155 */ 156 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 157 public com.liferay.portal.model.Role getRole(long companyId, 158 java.lang.String name) 159 throws com.liferay.portal.kernel.exception.PortalException, 160 com.liferay.portal.kernel.exception.SystemException; 161 162 /** 163 * Returns all the user's roles within the user group. 164 * 165 * @param userId the primary key of the user 166 * @param groupId the primary key of the group 167 * @return the user's roles within the user group 168 * @throws PortalException if a portal exception occurred 169 * @throws SystemException if a system exception occurred 170 */ 171 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 172 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 173 long userId, long groupId) 174 throws com.liferay.portal.kernel.exception.PortalException, 175 com.liferay.portal.kernel.exception.SystemException; 176 177 /** 178 * Returns all the user's roles within the user group. 179 * 180 * @param userId the primary key of the user 181 * @param groupId the primary key of the group 182 * @return the user's roles within the user group 183 * @throws PortalException if a portal exception occurred 184 * @throws SystemException if a system exception occurred 185 */ 186 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 187 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 188 long userId, long groupId) 189 throws com.liferay.portal.kernel.exception.PortalException, 190 com.liferay.portal.kernel.exception.SystemException; 191 192 /** 193 * Returns the union of all the user's roles within the groups. 194 * 195 * @param userId the primary key of the user 196 * @param groups the groups (optionally <code>null</code>) 197 * @return the union of all the user's roles within the groups 198 * @throws PortalException if a portal exception occurred 199 * @throws SystemException if a system exception occurred 200 */ 201 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 202 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 203 long userId, java.util.List<com.liferay.portal.model.Group> groups) 204 throws com.liferay.portal.kernel.exception.PortalException, 205 com.liferay.portal.kernel.exception.SystemException; 206 207 /** 208 * Returns all the roles associated with the user. 209 * 210 * @param userId the primary key of the user 211 * @return the roles associated with the user 212 * @throws PortalException if a portal exception occurred 213 * @throws SystemException if a system exception occurred 214 */ 215 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 216 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 217 long userId) 218 throws com.liferay.portal.kernel.exception.PortalException, 219 com.liferay.portal.kernel.exception.SystemException; 220 221 /** 222 * Returns <code>true</code> if the user is associated with the named 223 * regular role. 224 * 225 * @param userId the primary key of the user 226 * @param companyId the primary key of the company 227 * @param name the name of the role 228 * @param inherited whether to include the user's inherited roles in the 229 search 230 * @return <code>true</code> if the user is associated with the regular 231 role; <code>false</code> otherwise 232 * @throws PortalException if a role with the name could not be found in the 233 company or if a default user for the company could not be found 234 * @throws SystemException if a system exception occurred 235 */ 236 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 237 public boolean hasUserRole(long userId, long companyId, 238 java.lang.String name, boolean inherited) 239 throws com.liferay.portal.kernel.exception.PortalException, 240 com.liferay.portal.kernel.exception.SystemException; 241 242 /** 243 * Returns <code>true</code> if the user has any one of the named regular 244 * roles. 245 * 246 * @param userId the primary key of the user 247 * @param companyId the primary key of the company 248 * @param names the names of the roles 249 * @param inherited whether to include the user's inherited roles in the 250 search 251 * @return <code>true</code> if the user has any one of the regular roles; 252 <code>false</code> otherwise 253 * @throws PortalException if any one of the roles with the names could not 254 be found in the company or if the default user for the company 255 could not be found 256 * @throws SystemException if a system exception occurred 257 */ 258 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 259 public boolean hasUserRoles(long userId, long companyId, 260 java.lang.String[] names, boolean inherited) 261 throws com.liferay.portal.kernel.exception.PortalException, 262 com.liferay.portal.kernel.exception.SystemException; 263 264 /** 265 * Removes the matching roles associated with the user. The user is 266 * reindexed after the roles are removed. 267 * 268 * @param userId the primary key of the user 269 * @param roleIds the primary keys of the roles 270 * @throws PortalException if a user with the primary key could not be 271 found, if the user did not have permission to remove members from 272 a role, or if a role with any one of the primary keys could not 273 be found 274 * @throws SystemException if a system exception occurred 275 */ 276 public void unsetUserRoles(long userId, long[] roleIds) 277 throws com.liferay.portal.kernel.exception.PortalException, 278 com.liferay.portal.kernel.exception.SystemException; 279 280 /** 281 * Updates the role with the primary key. 282 * 283 * @param roleId the primary key of the role 284 * @param name the role's new name 285 * @param titleMap the new localized titles (optionally <code>null</code>) 286 to replace those existing for the role 287 * @param descriptionMap the new localized descriptions (optionally 288 <code>null</code>) to replace those existing for the role 289 * @param subtype the role's new subtype (optionally <code>null</code>) 290 * @return the role with the primary key 291 * @throws PortalException if the user did not have permission to update the 292 role, if a role with the primary could not be found, or if the 293 role's name was invalid 294 * @throws SystemException if a system exception occurred 295 */ 296 public com.liferay.portal.model.Role updateRole(long roleId, 297 java.lang.String name, 298 java.util.Map<java.util.Locale, java.lang.String> titleMap, 299 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 300 java.lang.String subtype) 301 throws com.liferay.portal.kernel.exception.PortalException, 302 com.liferay.portal.kernel.exception.SystemException; 303 }