1 package org.apache.turbine.services.security;
2
3 /* ====================================================================
4 * The Apache Software License, Version 1.1
5 *
6 * Copyright (c) 2001 The Apache Software Foundation. All rights
7 * reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. The end-user documentation included with the redistribution,
22 * if any, must include the following acknowledgment:
23 * "This product includes software developed by the
24 * Apache Software Foundation (http://www.apache.org/)."
25 * Alternately, this acknowledgment may appear in the software itself,
26 * if and wherever such third-party acknowledgments normally appear.
27 *
28 * 4. The names "Apache" and "Apache Software Foundation" and
29 * "Apache Turbine" must not be used to endorse or promote products
30 * derived from this software without prior written permission. For
31 * written permission, please contact apache@apache.org.
32 *
33 * 5. Products derived from this software may not be called "Apache",
34 * "Apache Turbine", nor may "Apache" appear in their name, without
35 * prior written permission of the Apache Software Foundation.
36 *
37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * SUCH DAMAGE.
49 * ====================================================================
50 *
51 * This software consists of voluntary contributions made by many
52 * individuals on behalf of the Apache Software Foundation. For more
53 * information on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57 import org.apache.torque.util.Criteria;
58 import org.apache.turbine.om.security.Group;
59 import org.apache.turbine.om.security.Permission;
60 import org.apache.turbine.om.security.Role;
61 import org.apache.turbine.om.security.User;
62 import org.apache.turbine.services.TurbineServices;
63 import org.apache.turbine.util.security.AccessControlList;
64 import org.apache.turbine.util.security.DataBackendException;
65 import org.apache.turbine.util.security.EntityExistsException;
66 import org.apache.turbine.util.security.GroupSet;
67 import org.apache.turbine.util.security.PasswordMismatchException;
68 import org.apache.turbine.util.security.PermissionSet;
69 import org.apache.turbine.util.security.RoleSet;
70 import org.apache.turbine.util.security.TurbineSecurityException;
71 import org.apache.turbine.util.security.UnknownEntityException;
72
73 /***
74 * This is a Facade class for SecurityService.
75 *
76 * This class provides static methods that call related methods of the
77 * implementation of SecurityService used by the System, according to
78 * the settings in TurbineResources.
79 * <br>
80 *
81 * <a name="global">
82 * <p> Certain Roles that the Users may have in the system may are not related
83 * to any specific resource nor entity. They are assigned within a special group
84 * named 'global' that can be referenced in the code as {@link org.apache.turbine.om.security.Group#GLOBAL_GROUP_NAME}.
85 *
86 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
87 * @version $Id: TurbineSecurity.java,v 1.3 2002/07/11 16:53:24 mpoeschl Exp $
88 */
89 public abstract class TurbineSecurity
90 {
91 /***
92 * Retrieves an implementation of SecurityService, base on the settings in
93 * TurbineResources.
94 *
95 * @return an implementation of SecurityService.
96 */
97 public static SecurityService getService()
98 {
99 return (SecurityService)TurbineServices.getInstance().
100 getService(SecurityService.SERVICE_NAME);
101 }
102
103 /*-----------------------------------------------------------------------
104 Management of User objects
105 -----------------------------------------------------------------------*/
106
107 /*
108 * This method provides client-side encryption of passwords.
109 *
110 * This is an utility method that is used by other classes to maintain
111 * a consistent approach to encrypting password. The behavior of the
112 * method can be configured in service's properties.
113 *
114 * @param password the password to process
115 * @return processed password
116 */
117 public static String encryptPassword( String password )
118 {
119 return getService().encryptPassword(password);
120 }
121
122 /***
123 * Return a Class object representing the system's chosen implementation of
124 * of User interface.
125 *
126 * @return systems's chosen implementation of User interface.
127 * @throws UnknownEntityException if the implementation of User interface
128 * could not be determined, or does not exist.
129 */
130 public static Class getUserClass()
131 throws UnknownEntityException
132 {
133 return getService().getUserClass();
134 }
135
136 /***
137 * Construct a blank User object.
138 *
139 * This method calls getUserClass, and then creates a new object using
140 * the default constructor.
141 *
142 * @return an object implementing User interface.
143 * @throws UnknownEntityException if the object could not be instantiated.
144 */
145 public static User getUserInstance()
146 throws UnknownEntityException
147 {
148 return getService().getUserInstance();
149 }
150
151 /***
152 * Check whether a specified user's account exists.
153 *
154 * The login name is used for looking up the account.
155 *
156 * @param user The user to be checked.
157 * @return true if the specified account exists
158 * @throws DataBackendException if there was an error accessing the data backend.
159 */
160 public static boolean accountExists( User user )
161 throws DataBackendException
162 {
163 return getService().accountExists(user);
164 }
165
166 /***
167 * Check whether a specified user's account exists.
168 *
169 * The login name is used for looking up the account.
170 *
171 * @param usename The name of the user to be checked.
172 * @return true if the specified account exists
173 * @throws DataBackendException if there was an error accessing the data backend.
174 */
175 public static boolean accountExists( String username )
176 throws DataBackendException
177 {
178 return getService().accountExists(username);
179 }
180
181 /***
182 * Authenticates an user, and constructs an User object to represent him/her.
183 *
184 * @param username The user name.
185 * @param password The user password.
186 * @return An authenticated Turbine User.
187 * @throws DataBackendException if there was an error accessing the data backend.
188 * @throws UnknownEntityException if user account is not present.
189 * @throws PasswordMissmatchException if the supplied password was incorrect.
190 */
191 public static User getAuthenticatedUser( String username, String password)
192 throws DataBackendException, UnknownEntityException, PasswordMismatchException
193 {
194 return getService().getAuthenticatedUser(username, password);
195 }
196
197 /***
198 * Constructs an User object to represent a registered user of the application.
199 *
200 * @param username The user name.
201 * @return A Turbine User.
202 * @throws DataBackendException if there was an error accessing the data backend.
203 * @throws UnknownEntityException if user account is not present.
204 */
205 public static User getUser( String username )
206 throws DataBackendException, UnknownEntityException
207 {
208 return getService().getUser(username);
209 }
210
211 /***
212 * Retrieve a set of users that meet the specified criteria.
213 *
214 * As the keys for the criteria, you should use the constants that
215 * are defined in {@link User} interface, plus the names
216 * of the custom attributes you added to your user representation
217 * in the data storage. Use verbatim names of the attributes -
218 * without table name prefix in case of DB implementation.
219 *
220 * @param criteria The criteria of selection.
221 * @return a List of users meeting the criteria.
222 * @throws DataBackendException if there is a problem accessing the
223 * storage.
224 */
225 public static User[] getUsers( Criteria criteria )
226 throws DataBackendException
227 {
228 return getService().getUsers(criteria);
229 }
230
231 /***
232 * Constructs an User object to represent an anonymous user of the application.
233 *
234 * @return An anonymous Turbine User.
235 * @throws UnknownEntityException if the anonymous User object couldn't be
236 * constructed.
237 */
238 public static User getAnonymousUser()
239 throws UnknownEntityException
240 {
241 return getService().getAnonymousUser();
242 }
243
244 /***
245 * Saves User's data in the permanent storage. The user account is required
246 * to exist in the storage.
247 *
248 * @exception UnknownEntityException if the user's account does not
249 * exist in the database.
250 * @exception DataBackendException if there is a problem accessing the
251 * storage.
252 */
253 public static void saveUser( User user )
254 throws UnknownEntityException, DataBackendException
255 {
256 getService().saveUser(user);
257 }
258
259 /***
260 * Change the password for an User.
261 *
262 * @param user an User to change password for.
263 * @param oldPassword the current password supplied by the user.
264 * @param newPassword the current password requested by the user.
265 * @exception PasswordMismatchException if the supplied password was
266 * incorrect.
267 * @exception UnknownEntityException if the user's record does not
268 * exist in the database.
269 * @exception DataBackendException if there is a problem accessing the
270 * storage.
271 */
272 public static void changePassword( User user, String oldPassword, String newPassword )
273 throws PasswordMismatchException, UnknownEntityException,
274 DataBackendException
275 {
276 getService().changePassword(user, oldPassword, newPassword);
277 }
278
279 /***
280 * Forcibly sets new password for an User.
281 *
282 * This is supposed by the administrator to change the forgotten or
283 * compromised passwords. Certain implementatations of this feature
284 * would require administrative level access to the authenticating
285 * server / program.
286 *
287 * @param user an User to change password for.
288 * @param password the new password.
289 * @exception UnknownEntityException if the user's record does not
290 * exist in the database.
291 * @exception DataBackendException if there is a problem accessing the
292 * storage.
293 */
294 public static void forcePassword( User user, String password )
295 throws UnknownEntityException, DataBackendException
296 {
297 getService().forcePassword( user, password );
298 }
299
300 /*-----------------------------------------------------------------------
301 Creation of AccessControlLists
302 -----------------------------------------------------------------------*/
303
304 /***
305 * Constructs an AccessControlList for a specific user.
306 *
307 * @param user the user for whom the AccessControlList are to be retrieved
308 * @throws DataBackendException if there was an error accessing the data backend.
309 * @throws UnknownEntityException if user account is not present.
310 */
311 public static AccessControlList getACL( User user )
312 throws DataBackendException, UnknownEntityException
313 {
314 return getService().getACL(user);
315 }
316
317 /*-----------------------------------------------------------------------
318 Security management
319 -----------------------------------------------------------------------*/
320
321 /***
322 * Grant an User a Role in a Group.
323 *
324 * @param User the user.
325 * @param Group the group.
326 * @param Role the role.
327 * @throws DataBackendException if there was an error accessing the data backend.
328 * @throws UnknownEntityException if user account, group or role is not present.
329 */
330 public static void grant( User user, Group group, Role role )
331 throws DataBackendException, UnknownEntityException
332 {
333 getService().grant(user, group, role);
334 }
335
336 /***
337 * Revoke a Role in a Group from an User.
338 *
339 * @param User the user.
340 * @param Group the group.
341 * @param Role the role.
342 * @throws DataBackendException if there was an error accessing the data backend.
343 * @throws UnknownEntityException if user account, group or role is not present.
344 */
345 public static void revoke( User user, Group group, Role role )
346 throws DataBackendException, UnknownEntityException
347 {
348 getService().revoke(user, group, role);
349 }
350
351 /***
352 * Revokes all roles from an User.
353 *
354 * This method is used when deleting an account.
355 *
356 * @param user the User.
357 * @throws DataBackendException if there was an error accessing the data backend.
358 * @throws UnknownEntityException if the account is not present.
359 */
360 public static void revokeAll( User user )
361 throws DataBackendException, UnknownEntityException
362 {
363 getService().revokeAll(user);
364 }
365
366 /***
367 * Grants a Role a Permission
368 *
369 * @param role the Role.
370 * @param permission the Permission.
371 * @throws DataBackendException if there was an error accessing the data backend.
372 * @throws UnknownEntityException if role or permission is not present.
373 */
374 public static void grant( Role role, Permission permission )
375 throws DataBackendException, UnknownEntityException
376 {
377 getService().grant(role, permission);
378 }
379
380 /***
381 * Revokes a Permission from a Role.
382 *
383 * @param role the Role.
384 * @param permission the Permission.
385 * @throws DataBackendException if there was an error accessing the data backend.
386 * @throws UnknownEntityException if role or permission is not present.
387 */
388 public static void revoke( Role role, Permission permission )
389 throws DataBackendException, UnknownEntityException
390 {
391 getService().revoke(role, permission);
392 }
393
394 /***
395 * Revokes all permissions from a Role.
396 *
397 * This method is user when deleting a Role.
398 *
399 * @param role the Role
400 * @throws DataBackendException if there was an error accessing the data backend.
401 * @throws UnknownEntityException if the Role is not present.
402 */
403 public static void revokeAll( Role role )
404 throws DataBackendException, UnknownEntityException
405 {
406 getService().revokeAll(role);
407 }
408
409 /*-----------------------------------------------------------------------
410 Account management
411 -----------------------------------------------------------------------*/
412
413 /***
414 * Creates new user account with specified attributes.
415 *
416 * <strong>TODO</strong> throw more specific exception<br>
417 *
418 * @param user the object describing account to be created.
419 * @throws DataBackendException if there was an error accessing the data backend.
420 * @throws EntityExistsException if the user account already exists.
421 */
422 public static void addUser( User user, String password )
423 throws DataBackendException, EntityExistsException
424 {
425 getService().addUser(user, password);
426 }
427
428
429 /***
430 * Removes an user account from the system.
431 *
432 * <strong>TODO</strong> throw more specific exception<br>
433 *
434 * @param user the object describing the account to be removed.
435 * @throws DataBackendException if there was an error accessing the data backend.
436 * @throws UnknownEntityException if the user account is not present.
437 */
438 public static void removeUser( User user )
439 throws DataBackendException, UnknownEntityException
440 {
441 getService().removeUser(user);
442 }
443
444
445 /*-----------------------------------------------------------------------
446 Group/Role/Permission management
447 -----------------------------------------------------------------------*/
448 /***
449 * Provides a reference to the Group object that represents the
450 * <a name="global">global group</a>.
451 *
452 * @return a Group object that represents the global group.
453 */
454 public static Group getGlobalGroup()
455 {
456 return getService().getGlobalGroup();
457 }
458
459 /***
460 * Creates a new Group in the system. This is a convenience
461 * method.
462 *
463 * @param name The name of the new Group.
464 * @return An object representing the new Group.
465 * @throws TurbineSecurityException if the Group could not be created.
466 */
467 public static Group createGroup( String name )
468 throws TurbineSecurityException
469 {
470 return getService().addGroup(getNewGroup(name));
471 }
472
473 /***
474 * Creates a new Permission in the system. This is a convenience
475 * method.
476 *
477 * @param name The name of the new Permission.
478 * @return An object representing the new Permission.
479 * @throws TurbineSecurityException if the Permission could not be created.
480 */
481 public static Permission createPermission( String name )
482 throws TurbineSecurityException
483 {
484 return getService().addPermission(getNewPermission(name));
485 }
486
487 /***
488 * Retrieves a named Group.
489 *
490 * @param groupName The name of the Group to be retrieved.
491 * @throws DataBackendException if there was an error accessing the data backend.
492 * @throws UnknownEntityException if the Group is not present.
493 */
494 public static Group getGroup( String groupName )
495 throws DataBackendException, UnknownEntityException
496 {
497 return getService().getGroup(groupName);
498 }
499
500 /***
501 * Retrieves a named Group. If the Group does not exist, it creates
502 * a new Group based on the Services Group implementation. It is ok
503 * to pass in null or "" here and then use Group.setName() at a later
504 * point.
505 *
506 * @param groupName The name of the Group to be retrieved.
507 * @throws DataBackendException if there was an error accessing the data backend.
508 */
509 public static Group getNewGroup( String groupName )
510 throws DataBackendException
511 {
512 return getService().getNewGroup(groupName);
513 }
514
515 /***
516 * Retrieves a named Permission. If the Permission does not exist, it creates
517 * a new Permission based on the Services Permission implementation. It is ok
518 * to pass in null or "" here and then use Permission.setName() at a later
519 * point.
520 *
521 * @param roleName The name of the Role to be retrieved.
522 * @throws DataBackendException if there was an error accessing the data backend.
523 */
524 public static Role getNewRole( String roleName )
525 throws TurbineSecurityException
526 {
527 return getService().getNewRole(roleName);
528 }
529
530 /***
531 * Retrieves a named Permission. If the Permission does not exist, it creates
532 * a new Permission based on the Services Permission implementation. It is ok
533 * to pass in null or "" here and then use Permission.setName() at a later
534 * point.
535 *
536 * @param groupName The name of the Permission to be retrieved.
537 * @throws DataBackendException if there was an error accessing the data backend.
538 */
539 public static Permission getNewPermission( String permissionName )
540 throws DataBackendException
541 {
542 return getService().getNewPermission(permissionName);
543 }
544
545 /***
546 * Retrieves a named Role.
547 *
548 * @param roleName The name of the Role to be retrieved.
549 * @throws DataBackendException if there was an error accessing the data backend.
550 * @throws UnknownEntityException if the Role is not present.
551 */
552 public static Role getRole( String roleName )
553 throws DataBackendException, UnknownEntityException
554 {
555 return getService().getRole(roleName);
556 }
557
558 /***
559 * Retrieves a named Permission.
560 *
561 * @param permissionName The name of the Permission to be retrieved.
562 * @throws DataBackendException if there was an error accessing the data backend.
563 * @throws UnknownEntityException if the Permission is not present.
564 */
565 public static Permission getPermission( String permissionName )
566 throws DataBackendException, UnknownEntityException
567 {
568 return getService().getPermission(permissionName);
569 }
570
571 /***
572 * Retrieve a set of Groups that meet the specified Criteria.
573 *
574 * @param a Criteria of Group selection.
575 * @return a set of Groups that meet the specified Criteria.
576 */
577 public static GroupSet getGroups( Criteria criteria )
578 throws DataBackendException
579 {
580 return getService().getGroups(criteria);
581 }
582
583
584 /***
585 * Retrieve a set of Roles that meet the specified Criteria.
586 *
587 * @param criteria a Criteria of Roles selection.
588 * @return a set of Roles that meet the specified Criteria.
589 */
590 public static RoleSet getRoles( Criteria criteria )
591 throws DataBackendException
592 {
593 return getService().getRoles(criteria);
594 }
595
596 /***
597 * Retrieve a set of Permissions that meet the specified Criteria.
598 *
599 * @param criteria a Criteria of Permissions selection.
600 * @return a set of Permissions that meet the specified Criteria.
601 */
602 public static PermissionSet getPermissions( Criteria criteria )
603 throws DataBackendException
604 {
605 return getService().getPermissions(criteria);
606 }
607
608 /***
609 * Retrieves all groups defined in the system.
610 *
611 * @return the names of all groups defined in the system.
612 */
613 public static GroupSet getAllGroups()
614 throws DataBackendException
615 {
616 return getService().getAllGroups();
617 }
618
619 /***
620 * Retrieves all roles defined in the system.
621 *
622 * @return the names of all roles defined in the system.
623 * @throws DataBackendException if there was an error accessing the data backend.
624 */
625 public static RoleSet getAllRoles()
626 throws DataBackendException
627 {
628 return getService().getAllRoles();
629 }
630
631 /***
632 * Retrieves all permissions defined in the system.
633 *
634 * @return the names of all roles defined in the system.
635 * @throws DataBackendException if there was an error accessing the data backend.
636 */
637 public static PermissionSet getAllPermissions()
638 throws DataBackendException
639 {
640 return getService().getAllPermissions();
641 }
642
643 /***
644 * Retrieves all permissions associated with a role.
645 *
646 * @param role the role name, for which the permissions are to be retrieved.
647 * @throws DataBackendException if there was an error accessing the data backend.
648 * @throws UnknownEntityException if the role is not present.
649 */
650 public static PermissionSet getPermissions( Role role )
651 throws DataBackendException, UnknownEntityException
652 {
653 return getService().getPermissions(role);
654 }
655
656 /***
657 * Stores Group's attributes. The Groups is required to exist in the system.
658 *
659 * @param group The Group to be stored.
660 * @throws DataBackendException if there was an error accessing the data backend.
661 * @throws UnknownEntityException if the group does not exist.
662 */
663 public static void saveGroup( Group group )
664 throws DataBackendException, UnknownEntityException
665 {
666 getService().saveGroup(group);
667 }
668
669 /***
670 * Stores Role's attributes. The Roles is required to exist in the system.
671 *
672 * @param role The Role to be stored.
673 * @throws DataBackendException if there was an error accessing the data backend.
674 * @throws UnknownEntityException if the role does not exist.
675 */
676 public static void saveRole( Role role )
677 throws DataBackendException, UnknownEntityException
678 {
679 getService().saveRole(role);
680 }
681
682 /***
683 * Stores Permission's attributes. The Permissions is required to exist in the system.
684 *
685 * @param permission The Permission to be stored.
686 * @throws DataBackendException if there was an error accessing the data backend.
687 * @throws UnknownEntityException if the permission does not exist.
688 */
689 public static void savePermission( Permission permission )
690 throws DataBackendException, UnknownEntityException
691 {
692 getService().savePermission(permission);
693 }
694
695 /***
696 * Creates a new group with specified attributes.
697 *
698 * @param group the object describing the group to be created.
699 * @throws DataBackendException if there was an error accessing the data backend.
700 * @throws EntityExistsException if the group already exists.
701 */
702 public static void addGroup( Group group )
703 throws DataBackendException, EntityExistsException
704 {
705 getService().addGroup(group);
706 }
707
708 /***
709 * Creates a new role with specified attributes.
710 *
711 * @param group the objects describing the group to be created.
712 * @throws DataBackendException if there was an error accessing the data backend.
713 * @throws EntityExistsException if the role already exists.
714 */
715 public static void addRole( Role role )
716 throws DataBackendException, EntityExistsException
717 {
718 getService().addRole(role);
719 }
720
721 /***
722 * Creates a new permission with specified attributes.
723 *
724 * @param group the objects describing the group to be created.
725 * @throws DataBackendException if there was an error accessing the data backend.
726 * @throws EntityExistsException if the permission already exists.
727 */
728 public static void addPermission( Permission permission )
729 throws DataBackendException, EntityExistsException
730 {
731 getService().addPermission(permission);
732 }
733
734 /***
735 * Removes a Group from the system.
736 *
737 * @param the object describing group to be removed.
738 * @throws DataBackendException if there was an error accessing the data backend.
739 * @throws UnknownEntityException if the group does not exist.
740 */
741 public static void removeGroup( Group group )
742 throws DataBackendException, UnknownEntityException
743 {
744 getService().removeGroup(group);
745 }
746
747 /***
748 * Removes a Role from the system.
749 *
750 * @param the object describing role to be removed.
751 * @throws DataBackendException if there was an error accessing the data backend.
752 * @throws UnknownEntityException if the role does not exist.
753 */
754 public static void removeRole( Role role )
755 throws DataBackendException, UnknownEntityException
756 {
757 getService().removeRole(role);
758 }
759
760 /***
761 * Removes a Permission from the system.
762 *
763 * @param the object describing permission to be removed.
764 * @throws DataBackendException if there was an error accessing the data backend.
765 * @throws UnknownEntityException if the permission does not exist.
766 */
767 public static void removePermission( Permission permission )
768 throws DataBackendException, UnknownEntityException
769 {
770 getService().removePermission(permission);
771 }
772
773 /***
774 * Renames an existing Group.
775 *
776 * @param the object describing the group to be renamed.
777 * @param name the new name for the group.
778 * @throws DataBackendException if there was an error accessing the data backend.
779 * @throws UnknownEntityException if the group does not exist.
780 */
781 public static void renameGroup( Group group, String name )
782 throws DataBackendException, UnknownEntityException
783 {
784 getService().renameGroup(group, name);
785 }
786
787 /***
788 * Renames an existing Role.
789 *
790 * @param the object describing the role to be renamed.
791 * @param name the new name for the role.
792 * @throws DataBackendException if there was an error accessing the data backend.
793 * @throws UnknownEntityException if the role does not exist.
794 */
795 public static void renameRole( Role role, String name )
796 throws DataBackendException, UnknownEntityException
797 {
798 getService().renameRole(role, name);
799 }
800
801 /***
802 * Renames an existing Permission.
803 *
804 * @param the object describing the permission to be renamed.
805 * @param name the new name for the permission.
806 * @throws DataBackendException if there was an error accessing the data backend.
807 * @throws UnknownEntityException if the permission does not exist.
808 */
809 public static void renamePermission( Permission permission, String name )
810 throws DataBackendException, UnknownEntityException
811 {
812 getService().renamePermission(permission, name);
813 }
814 }
This page was automatically generated by Maven