001 /** 002 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 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 import com.liferay.portal.security.ac.AccessControlled; 024 025 /** 026 * The interface for the role remote service. 027 * 028 * <p> 029 * 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. 030 * </p> 031 * 032 * @author Brian Wing Shun Chan 033 * @see RoleServiceUtil 034 * @see com.liferay.portal.service.base.RoleServiceBaseImpl 035 * @see com.liferay.portal.service.impl.RoleServiceImpl 036 * @generated 037 */ 038 @AccessControlled 039 @JSONWebService 040 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 041 PortalException.class, SystemException.class}) 042 public interface RoleService extends BaseService { 043 /* 044 * NOTE FOR DEVELOPERS: 045 * 046 * 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. 047 */ 048 049 /** 050 * Returns the Spring bean ID for this bean. 051 * 052 * @return the Spring bean ID for this bean 053 */ 054 public java.lang.String getBeanIdentifier(); 055 056 /** 057 * Sets the Spring bean ID for this bean. 058 * 059 * @param beanIdentifier the Spring bean ID for this bean 060 */ 061 public void setBeanIdentifier(java.lang.String beanIdentifier); 062 063 /** 064 * Adds a role. The user is reindexed after role is added. 065 * 066 * @param className the name of the class for which the role is created 067 * @param classPK the primary key of the class for which the role is 068 created (optionally <code>0</code>) 069 * @param name the role's name 070 * @param titleMap the role's localized titles (optionally 071 <code>null</code>) 072 * @param descriptionMap the role's localized descriptions (optionally 073 <code>null</code>) 074 * @param type the role's type (optionally <code>0</code>) 075 * @param subType the role's subtype (optionally <code>null</code>) 076 * @param serviceContext the role's service context (optionally 077 <code>null</code>). Can set the expando bridge attributes for the 078 role. 079 * @return the role 080 * @throws PortalException if a user with the primary key could not be 081 found, if the user did not have permission to add roles, if the 082 class name or the role name were invalid, or if the role is a 083 duplicate 084 * @throws SystemException if a system exception occurred 085 */ 086 public com.liferay.portal.model.Role addRole(java.lang.String className, 087 long classPK, java.lang.String name, 088 java.util.Map<java.util.Locale, java.lang.String> titleMap, 089 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 090 int type, java.lang.String subType, 091 com.liferay.portal.service.ServiceContext serviceContext) 092 throws com.liferay.portal.kernel.exception.PortalException, 093 com.liferay.portal.kernel.exception.SystemException; 094 095 /** 096 * Adds a role. The user is reindexed after role is added. 097 * 098 * @param name the role's name 099 * @param titleMap the role's localized titles (optionally 100 <code>null</code>) 101 * @param descriptionMap the role's localized descriptions (optionally 102 <code>null</code>) 103 * @param type the role's type (optionally <code>0</code>) 104 * @return the role 105 * @throws PortalException if a user with the primary key could not be 106 found, if the user did not have permission to add roles, if 107 the class name or the role name were invalid, or if the role 108 is a duplicate 109 * @throws SystemException if a system exception occurred 110 * @deprecated {@link #addRole(String, long, String, Map, Map, int, String, 111 ServiceContext)} 112 */ 113 public com.liferay.portal.model.Role addRole(java.lang.String name, 114 java.util.Map<java.util.Locale, java.lang.String> titleMap, 115 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 116 int type) 117 throws com.liferay.portal.kernel.exception.PortalException, 118 com.liferay.portal.kernel.exception.SystemException; 119 120 /** 121 * Adds the roles to the user. The user is reindexed after the roles are 122 * added. 123 * 124 * @param userId the primary key of the user 125 * @param roleIds the primary keys of the roles 126 * @throws PortalException if a user with the primary key could not be found 127 or if the user did not have permission to assign members to one 128 of the roles 129 * @throws SystemException if a system exception occurred 130 */ 131 public void addUserRoles(long userId, long[] roleIds) 132 throws com.liferay.portal.kernel.exception.PortalException, 133 com.liferay.portal.kernel.exception.SystemException; 134 135 /** 136 * Deletes the role with the primary key and its associated permissions. 137 * 138 * @param roleId the primary key of the role 139 * @throws PortalException if the user did not have permission to delete the 140 role, if a role with the primary key could not be found, if the 141 role is a default system role, or if the role's resource could 142 not be found 143 * @throws SystemException if a system exception occurred 144 */ 145 public void deleteRole(long roleId) 146 throws com.liferay.portal.kernel.exception.PortalException, 147 com.liferay.portal.kernel.exception.SystemException; 148 149 /** 150 * Returns all the roles associated with the group. 151 * 152 * @param groupId the primary key of the group 153 * @return the roles associated with the group 154 * @throws PortalException if a portal exception occurred 155 * @throws SystemException if a system exception occurred 156 */ 157 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 158 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 159 long groupId) 160 throws com.liferay.portal.kernel.exception.PortalException, 161 com.liferay.portal.kernel.exception.SystemException; 162 163 /** 164 * Returns the role with the primary key. 165 * 166 * @param roleId the primary key of the role 167 * @return the role with the primary key 168 * @throws PortalException if a role with the primary key could not be found 169 or if the user did not have permission to view the role 170 * @throws SystemException if a system exception occurred 171 */ 172 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 173 public com.liferay.portal.model.Role getRole(long roleId) 174 throws com.liferay.portal.kernel.exception.PortalException, 175 com.liferay.portal.kernel.exception.SystemException; 176 177 /** 178 * Returns the role with the name in the company. 179 * 180 * <p> 181 * The method searches the system roles map first for default roles. If a 182 * role with the name is not found, then the method will query the database. 183 * </p> 184 * 185 * @param companyId the primary key of the company 186 * @param name the role's name 187 * @return the role with the name 188 * @throws PortalException if a role with the name could not be found in the 189 company or if the user did not have permission to view the role 190 * @throws SystemException if a system exception occurred 191 */ 192 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 193 public com.liferay.portal.model.Role getRole(long companyId, 194 java.lang.String name) 195 throws com.liferay.portal.kernel.exception.PortalException, 196 com.liferay.portal.kernel.exception.SystemException; 197 198 /** 199 * Returns all the user's roles within the user group. 200 * 201 * @param userId the primary key of the user 202 * @param groupId the primary key of the group 203 * @return the user's roles within the user group 204 * @throws PortalException if a portal exception occurred 205 * @throws SystemException if a system exception occurred 206 */ 207 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 208 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 209 long userId, long groupId) 210 throws com.liferay.portal.kernel.exception.PortalException, 211 com.liferay.portal.kernel.exception.SystemException; 212 213 /** 214 * Returns all the user's roles within the user group. 215 * 216 * @param userId the primary key of the user 217 * @param groupId the primary key of the group 218 * @return the user's roles within the user group 219 * @throws PortalException if a portal exception occurred 220 * @throws SystemException if a system exception occurred 221 */ 222 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 223 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 224 long userId, long groupId) 225 throws com.liferay.portal.kernel.exception.PortalException, 226 com.liferay.portal.kernel.exception.SystemException; 227 228 /** 229 * Returns the union of all the user's roles within the groups. 230 * 231 * @param userId the primary key of the user 232 * @param groups the groups (optionally <code>null</code>) 233 * @return the union of all the user's roles within the groups 234 * @throws PortalException if a portal exception occurred 235 * @throws SystemException if a system exception occurred 236 */ 237 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 238 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 239 long userId, java.util.List<com.liferay.portal.model.Group> groups) 240 throws com.liferay.portal.kernel.exception.PortalException, 241 com.liferay.portal.kernel.exception.SystemException; 242 243 /** 244 * Returns all the roles associated with the user. 245 * 246 * @param userId the primary key of the user 247 * @return the roles associated with the user 248 * @throws PortalException if a portal exception occurred 249 * @throws SystemException if a system exception occurred 250 */ 251 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 252 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 253 long userId) 254 throws com.liferay.portal.kernel.exception.PortalException, 255 com.liferay.portal.kernel.exception.SystemException; 256 257 /** 258 * Returns <code>true</code> if the user is associated with the named 259 * regular role. 260 * 261 * @param userId the primary key of the user 262 * @param companyId the primary key of the company 263 * @param name the name of the role 264 * @param inherited whether to include the user's inherited roles in the 265 search 266 * @return <code>true</code> if the user is associated with the regular 267 role; <code>false</code> otherwise 268 * @throws PortalException if a role with the name could not be found in the 269 company or if a default user for the company could not be found 270 * @throws SystemException if a system exception occurred 271 */ 272 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 273 public boolean hasUserRole(long userId, long companyId, 274 java.lang.String name, boolean inherited) 275 throws com.liferay.portal.kernel.exception.PortalException, 276 com.liferay.portal.kernel.exception.SystemException; 277 278 /** 279 * Returns <code>true</code> if the user has any one of the named regular 280 * roles. 281 * 282 * @param userId the primary key of the user 283 * @param companyId the primary key of the company 284 * @param names the names of the roles 285 * @param inherited whether to include the user's inherited roles in the 286 search 287 * @return <code>true</code> if the user has any one of the regular roles; 288 <code>false</code> otherwise 289 * @throws PortalException if any one of the roles with the names could not 290 be found in the company or if the default user for the company 291 could not be found 292 * @throws SystemException if a system exception occurred 293 */ 294 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 295 public boolean hasUserRoles(long userId, long companyId, 296 java.lang.String[] names, boolean inherited) 297 throws com.liferay.portal.kernel.exception.PortalException, 298 com.liferay.portal.kernel.exception.SystemException; 299 300 /** 301 * Removes the matching roles associated with the user. The user is 302 * reindexed after the roles are removed. 303 * 304 * @param userId the primary key of the user 305 * @param roleIds the primary keys of the roles 306 * @throws PortalException if a user with the primary key could not be 307 found, if the user did not have permission to remove members from 308 a role, or if a role with any one of the primary keys could not 309 be found 310 * @throws SystemException if a system exception occurred 311 */ 312 public void unsetUserRoles(long userId, long[] roleIds) 313 throws com.liferay.portal.kernel.exception.PortalException, 314 com.liferay.portal.kernel.exception.SystemException; 315 316 /** 317 * Updates the role with the primary key. 318 * 319 * @param roleId the primary key of the role 320 * @param name the role's new name 321 * @param titleMap the new localized titles (optionally <code>null</code>) 322 to replace those existing for the role 323 * @param descriptionMap the new localized descriptions (optionally 324 <code>null</code>) to replace those existing for the role 325 * @param subtype the role's new subtype (optionally <code>null</code>) 326 * @param serviceContext the role's service context (optionally 327 <code>null</code>). Can set the expando bridge attributes for the 328 role. 329 * @return the role with the primary key 330 * @throws PortalException if the user did not have permission to update the 331 role, if a role with the primary could not be found, or if the 332 role's name was invalid 333 * @throws SystemException if a system exception occurred 334 */ 335 public com.liferay.portal.model.Role updateRole(long roleId, 336 java.lang.String name, 337 java.util.Map<java.util.Locale, java.lang.String> titleMap, 338 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 339 java.lang.String subtype, 340 com.liferay.portal.service.ServiceContext serviceContext) 341 throws com.liferay.portal.kernel.exception.PortalException, 342 com.liferay.portal.kernel.exception.SystemException; 343 }