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