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 name the role's name 067 * @param titleMap the role's localized titles (optionally 068 <code>null</code>) 069 * @param descriptionMap the role's localized descriptions (optionally 070 <code>null</code>) 071 * @param type the role's type (optionally <code>0</code>) 072 * @return the role 073 * @throws PortalException if a user with the primary key could not be 074 found, if the user did not have permission to add roles, if the 075 class name or the role name were invalid, or if the role is a 076 duplicate 077 * @throws SystemException if a system exception occurred 078 */ 079 public com.liferay.portal.model.Role addRole(java.lang.String className, 080 long classPK, java.lang.String name, 081 java.util.Map<java.util.Locale, java.lang.String> titleMap, 082 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 083 int type, java.lang.String subType) 084 throws com.liferay.portal.kernel.exception.PortalException, 085 com.liferay.portal.kernel.exception.SystemException; 086 087 /** 088 * Adds a role. The user is reindexed after role is added. 089 * 090 * @param name the role's name 091 * @param titleMap the role's localized titles (optionally 092 <code>null</code>) 093 * @param descriptionMap the role's localized descriptions (optionally 094 <code>null</code>) 095 * @param type the role's type (optionally <code>0</code>) 096 * @return the role 097 * @throws PortalException if a user with the primary key could not be 098 found, if the user did not have permission to add roles, if the 099 class name or the role name were invalid, or if the role is a 100 duplicate 101 * @throws SystemException if a system exception occurred 102 * @deprecated {@link #addRole(String, long, String, Map, Map, int, String)} 103 */ 104 public com.liferay.portal.model.Role addRole(java.lang.String name, 105 java.util.Map<java.util.Locale, java.lang.String> titleMap, 106 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 107 int type) 108 throws com.liferay.portal.kernel.exception.PortalException, 109 com.liferay.portal.kernel.exception.SystemException; 110 111 /** 112 * Adds the roles to the user. The user is reindexed after the roles are 113 * added. 114 * 115 * @param userId the primary key of the user 116 * @param roleIds the primary keys of the roles 117 * @throws PortalException if a user with the primary key could not be found 118 or if the user did not have permission to assign members to one 119 of the roles 120 * @throws SystemException if a system exception occurred 121 */ 122 public void addUserRoles(long userId, long[] roleIds) 123 throws com.liferay.portal.kernel.exception.PortalException, 124 com.liferay.portal.kernel.exception.SystemException; 125 126 /** 127 * Deletes the role with the primary key and its associated permissions. 128 * 129 * @param roleId the primary key of the role 130 * @throws PortalException if the user did not have permission to delete the 131 role, if a role with the primary key could not be found, if the 132 role is a default system role, or if the role's resource could 133 not be found 134 * @throws SystemException if a system exception occurred 135 */ 136 public void deleteRole(long roleId) 137 throws com.liferay.portal.kernel.exception.PortalException, 138 com.liferay.portal.kernel.exception.SystemException; 139 140 /** 141 * Returns all the roles associated with the group. 142 * 143 * @param groupId the primary key of the group 144 * @return the roles associated with the group 145 * @throws PortalException if a portal exception occurred 146 * @throws SystemException if a system exception occurred 147 */ 148 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 149 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 150 long groupId) 151 throws com.liferay.portal.kernel.exception.PortalException, 152 com.liferay.portal.kernel.exception.SystemException; 153 154 /** 155 * Returns the role with the primary key. 156 * 157 * @param roleId the primary key of the role 158 * @return the role with the primary key 159 * @throws PortalException if a role with the primary key could not be found 160 or if the user did not have permission to view the role 161 * @throws SystemException if a system exception occurred 162 */ 163 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 164 public com.liferay.portal.model.Role getRole(long roleId) 165 throws com.liferay.portal.kernel.exception.PortalException, 166 com.liferay.portal.kernel.exception.SystemException; 167 168 /** 169 * Returns the role with the name in the company. 170 * 171 * <p> 172 * The method searches the system roles map first for default roles. If a 173 * role with the name is not found, then the method will query the database. 174 * </p> 175 * 176 * @param companyId the primary key of the company 177 * @param name the role's name 178 * @return the role with the name 179 * @throws PortalException if a role with the name could not be found in the 180 company or if the user did not have permission to view the role 181 * @throws SystemException if a system exception occurred 182 */ 183 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 184 public com.liferay.portal.model.Role getRole(long companyId, 185 java.lang.String name) 186 throws com.liferay.portal.kernel.exception.PortalException, 187 com.liferay.portal.kernel.exception.SystemException; 188 189 /** 190 * Returns all the user's roles within the user group. 191 * 192 * @param userId the primary key of the user 193 * @param groupId the primary key of the group 194 * @return the user's roles within the user group 195 * @throws PortalException if a portal exception occurred 196 * @throws SystemException if a system exception occurred 197 */ 198 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 199 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 200 long userId, long groupId) 201 throws com.liferay.portal.kernel.exception.PortalException, 202 com.liferay.portal.kernel.exception.SystemException; 203 204 /** 205 * Returns all the user's roles within the user group. 206 * 207 * @param userId the primary key of the user 208 * @param groupId the primary key of the group 209 * @return the user's roles within the user group 210 * @throws PortalException if a portal exception occurred 211 * @throws SystemException if a system exception occurred 212 */ 213 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 214 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 215 long userId, long groupId) 216 throws com.liferay.portal.kernel.exception.PortalException, 217 com.liferay.portal.kernel.exception.SystemException; 218 219 /** 220 * Returns the union of all the user's roles within the groups. 221 * 222 * @param userId the primary key of the user 223 * @param groups the groups (optionally <code>null</code>) 224 * @return the union of all the user's roles within the groups 225 * @throws PortalException if a portal exception occurred 226 * @throws SystemException if a system exception occurred 227 */ 228 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 229 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 230 long userId, java.util.List<com.liferay.portal.model.Group> groups) 231 throws com.liferay.portal.kernel.exception.PortalException, 232 com.liferay.portal.kernel.exception.SystemException; 233 234 /** 235 * Returns all the roles associated with the user. 236 * 237 * @param userId the primary key of the user 238 * @return the roles associated with the user 239 * @throws PortalException if a portal exception occurred 240 * @throws SystemException if a system exception occurred 241 */ 242 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 243 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 244 long userId) 245 throws com.liferay.portal.kernel.exception.PortalException, 246 com.liferay.portal.kernel.exception.SystemException; 247 248 /** 249 * Returns <code>true</code> if the user is associated with the named 250 * regular role. 251 * 252 * @param userId the primary key of the user 253 * @param companyId the primary key of the company 254 * @param name the name of the role 255 * @param inherited whether to include the user's inherited roles in the 256 search 257 * @return <code>true</code> if the user is associated with the regular 258 role; <code>false</code> otherwise 259 * @throws PortalException if a role with the name could not be found in the 260 company or if a default user for the company could not be found 261 * @throws SystemException if a system exception occurred 262 */ 263 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 264 public boolean hasUserRole(long userId, long companyId, 265 java.lang.String name, boolean inherited) 266 throws com.liferay.portal.kernel.exception.PortalException, 267 com.liferay.portal.kernel.exception.SystemException; 268 269 /** 270 * Returns <code>true</code> if the user has any one of the named regular 271 * roles. 272 * 273 * @param userId the primary key of the user 274 * @param companyId the primary key of the company 275 * @param names the names of the roles 276 * @param inherited whether to include the user's inherited roles in the 277 search 278 * @return <code>true</code> if the user has any one of the regular roles; 279 <code>false</code> otherwise 280 * @throws PortalException if any one of the roles with the names could not 281 be found in the company or if the default user for the company 282 could not be found 283 * @throws SystemException if a system exception occurred 284 */ 285 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 286 public boolean hasUserRoles(long userId, long companyId, 287 java.lang.String[] names, boolean inherited) 288 throws com.liferay.portal.kernel.exception.PortalException, 289 com.liferay.portal.kernel.exception.SystemException; 290 291 /** 292 * Removes the matching roles associated with the user. The user is 293 * reindexed after the roles are removed. 294 * 295 * @param userId the primary key of the user 296 * @param roleIds the primary keys of the roles 297 * @throws PortalException if a user with the primary key could not be 298 found, if the user did not have permission to remove members from 299 a role, or if a role with any one of the primary keys could not 300 be found 301 * @throws SystemException if a system exception occurred 302 */ 303 public void unsetUserRoles(long userId, long[] roleIds) 304 throws com.liferay.portal.kernel.exception.PortalException, 305 com.liferay.portal.kernel.exception.SystemException; 306 307 /** 308 * Updates the role with the primary key. 309 * 310 * @param roleId the primary key of the role 311 * @param name the role's new name 312 * @param titleMap the new localized titles (optionally <code>null</code>) 313 to replace those existing for the role 314 * @param descriptionMap the new localized descriptions (optionally 315 <code>null</code>) to replace those existing for the role 316 * @param subtype the role's new subtype (optionally <code>null</code>) 317 * @return the role with the primary key 318 * @throws PortalException if the user did not have permission to update the 319 role, if a role with the primary could not be found, or if the 320 role's name was invalid 321 * @throws SystemException if a system exception occurred 322 */ 323 public com.liferay.portal.model.Role updateRole(long roleId, 324 java.lang.String name, 325 java.util.Map<java.util.Locale, java.lang.String> titleMap, 326 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 327 java.lang.String subtype) 328 throws com.liferay.portal.kernel.exception.PortalException, 329 com.liferay.portal.kernel.exception.SystemException; 330 }