org.apache.turbine.om.security
Class TurbineRole

java.lang.Object
  extended by org.apache.turbine.om.security.SecurityObject<Role>
      extended by org.apache.turbine.om.security.TurbineRole
All Implemented Interfaces:
Serializable, Comparable<Role>, Role, SecurityEntity

public class TurbineRole
extends SecurityObject<Role>
implements Role

This class represents a role played by the User associated with the current Session.

Version:
$Id: TurbineRole.java 1078552 2011-03-06 19:58:46Z tv $
Author:
Frank Y. Kim, John D. McNally, Brett McLaughlin
See Also:
Serialized Form

Constructor Summary
TurbineRole()
          Constructs a new Role
TurbineRole(String name)
          Constructs a new Role with the sepcified name.
 
Method Summary
 Role create(String name)
          Creates a new Role in the system.
 PermissionSet getPermissions()
          Returns the set of Permissions associated with this Role.
 void grant(Permission permission)
          Grants a Permission to this Role.
 void grant(PermissionSet permissionSet)
          Grants Permissions from a PermissionSet to this Role.
 void remove()
          Removes a role from the system.
 void rename(String name)
          Renames the role.
 void revoke(Permission permission)
          Revokes a Permission from this Role.
 void revoke(PermissionSet permissionSet)
          Revokes Permissions from a PermissionSet from this Role.
 void save()
          Makes changes made to the Role attributes permanent.
 void save(Connection conn)
          not implemented
 void save(String dbname)
          not implemented
 void setPermissions(PermissionSet permissionSet)
          Sets the Permissions associated with this Role.
 
Methods inherited from class org.apache.turbine.om.security.SecurityObject
compareTo, getAttribute, getAttributes, getId, getIdAsObj, getName, setAttribute, setAttributes, setId, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.om.security.SecurityEntity
getId, getIdAsObj, getName, setId, setName
 

Constructor Detail

TurbineRole

public TurbineRole()
Constructs a new Role


TurbineRole

public TurbineRole(String name)
Constructs a new Role with the sepcified name.

Parameters:
name - The name of the new object.
Method Detail

getPermissions

public PermissionSet getPermissions()
                             throws Exception
Returns the set of Permissions associated with this Role.

Specified by:
getPermissions in interface Role
Returns:
A PermissionSet.
Throws:
Exception - a generic exception.

setPermissions

public void setPermissions(PermissionSet permissionSet)
Sets the Permissions associated with this Role.

Specified by:
setPermissions in interface Role
Parameters:
permissionSet - A PermissionSet.

create

public Role create(String name)
            throws TurbineSecurityException
Creates a new Role in the system.

Specified by:
create in interface Role
Parameters:
name - The name of the new Role.
Returns:
An object representing the new Role.
Throws:
TurbineSecurityException - if the Role could not be created.

save

public void save()
          throws TurbineSecurityException
Makes changes made to the Role attributes permanent.

Specified by:
save in interface Role
Throws:
TurbineSecurityException - if there is a problem while saving data.

save

public void save(Connection conn)
          throws Exception
not implemented

Parameters:
conn -
Throws:
Exception

save

public void save(String dbname)
          throws Exception
not implemented

Parameters:
dbname -
Throws:
Exception

remove

public void remove()
            throws TurbineSecurityException
Removes a role from the system.

Specified by:
remove in interface Role
Throws:
TurbineSecurityException - if the Role could not be removed.

rename

public void rename(String name)
            throws TurbineSecurityException
Renames the role.

Specified by:
rename in interface Role
Parameters:
name - The new Role name.
Throws:
TurbineSecurityException - if the Role could not be renamed.

grant

public void grant(Permission permission)
           throws TurbineSecurityException
Grants a Permission to this Role.

Specified by:
grant in interface Role
Parameters:
permission - A Permission.
Throws:
TurbineSecurityException - if there is a problem while assigning the Permission.

grant

public void grant(PermissionSet permissionSet)
           throws TurbineSecurityException
Grants Permissions from a PermissionSet to this Role.

Specified by:
grant in interface Role
Parameters:
permissionSet - A PermissionSet.
Throws:
TurbineSecurityException - if there is a problem while assigning the Permissions.

revoke

public void revoke(Permission permission)
            throws TurbineSecurityException
Revokes a Permission from this Role.

Specified by:
revoke in interface Role
Parameters:
permission - A Permission.
Throws:
TurbineSecurityException - if there is a problem while unassigning the Permission.

revoke

public void revoke(PermissionSet permissionSet)
            throws TurbineSecurityException
Revokes Permissions from a PermissionSet from this Role.

Specified by:
revoke in interface Role
Parameters:
permissionSet - A PermissionSet.
Throws:
TurbineSecurityException - if there is a problem while unassigning the Permissions.


Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.