jet.server.api.custom.security.role
Interface RoleProvider


public interface RoleProvider

Among the interfaces of JReport security API, RoleProvider is used to provide customized information of principal role, including relation information between 2 roles. In addition to getting role information from customer's external security system, this interface also provides the ability to modify role information in customer's external security system.

Since:
version 8

Field Summary
static java.lang.String TAG_ROLE_DESCRIPTION
          Property of role, indicates the description of a role, the value is "role_description".
static java.lang.String TAG_ROLE_NAME
          Property of role, indicates role name, the value is "role_name".
 
Method Summary
 void addRole(java.lang.String realmName, java.util.Properties props)
          Adds a role into customer's external security system.
 void addSubRole(java.lang.String realmName, java.lang.String roleName, java.lang.String subRole)
          Adds a sub-role into the specified parent role in customer's external security system.
 java.util.Iterator getAllRoles(java.lang.String realmName)
          Gets all role names from customer's external security system.
 java.util.Properties getRoleProperties(java.lang.String realmName, java.lang.String roleName)
          Gets a Properties used to represent a role.
 java.util.Iterator getSubRoles(java.lang.String realmName, java.lang.String roleName)
          Gets sub-role names of the specified parent role from customer's external security system.
 boolean isEnableEdit()
          Indicates whether customer's external security system will be modified by invoking some methods in RoleProvider.
In common cases, invoking addRole(), removeRole(), addSubRole() or removeSubRole() should take effect on customer's external security system, and cause modification of external security system, this method should return true in such cases.
 void removeRole(java.lang.String realmName, java.lang.String roleName)
          Removes the specified role from customer's external security system.
 void removeSubRole(java.lang.String realmName, java.lang.String roleName, java.lang.String subRole)
          Removes a sub-role from the specified parent role in customer's external security system.
 

Field Detail

TAG_ROLE_NAME

static final java.lang.String TAG_ROLE_NAME
Property of role, indicates role name, the value is "role_name". A role name is a String value that is non-null and whose length is bigger than zero.

See Also:
Constant Field Values

TAG_ROLE_DESCRIPTION

static final java.lang.String TAG_ROLE_DESCRIPTION
Property of role, indicates the description of a role, the value is "role_description". A role description is a String value.

See Also:
Constant Field Values
Method Detail

getAllRoles

java.util.Iterator getAllRoles(java.lang.String realmName)
                               throws JRCustomerException
Gets all role names from customer's external security system.

Parameters:
realmName - the realm name
Returns:
all role names.
Throws:
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

getRoleProperties

java.util.Properties getRoleProperties(java.lang.String realmName,
                                       java.lang.String roleName)
                                       throws NoSuchRoleException,
                                              JRCustomerException
Gets a Properties used to represent a role.

Parameters:
realmName - the realm name.
roleName - the role name.
Returns:
a Properties that represents a role. If a null or an empty Properties is returned, it means there is no any property for the specified role.
Throws:
NoSuchRoleException - If there is no role with the specified name in customer's external security system.
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

getSubRoles

java.util.Iterator getSubRoles(java.lang.String realmName,
                               java.lang.String roleName)
                               throws NoSuchRoleException,
                                      JRCustomerException
Gets sub-role names of the specified parent role from customer's external security system.

Parameters:
realmName - the realm name.
roleName - the parent role name.
Returns:
sub-role names of the specified parent role.
Throws:
NoSuchRoleException - If there is no role with the specified parent role name in customer's external security system.
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

addRole

void addRole(java.lang.String realmName,
             java.util.Properties props)
             throws RoleExistsException,
                    JRCustomerException
Adds a role into customer's external security system. This role is represented by a Properties.

Parameters:
realmName - the realm name.
props - a Properties that represents a role.
Throws:
RoleExistsException - If there is a role with the same name in customer's external security system.
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

removeRole

void removeRole(java.lang.String realmName,
                java.lang.String roleName)
                throws NoSuchRoleException,
                       JRCustomerException
Removes the specified role from customer's external security system.

Parameters:
realmName - the realm name.
roleName - the role name to specify which role needs to be removed.
Throws:
NoSuchRoleException - If there is no role with the specified name (indicated by TAG_ROLE_NAME in props) in customer's external security system.
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

addSubRole

void addSubRole(java.lang.String realmName,
                java.lang.String roleName,
                java.lang.String subRole)
                throws NoSuchRoleException,
                       RoleExistsException,
                       JRCustomerException
Adds a sub-role into the specified parent role in customer's external security system.

Parameters:
realmName - the realm name.
roleName - the parent role name which will be added a sub-role to.
subRole - the sub-role name which will be added into the specified parent role
Throws:
NoSuchRoleException - If the specified parent role or sub-role does not exist in customer's external security system.
RoleExistsException - If the parent role contains a sub-role, which has the same name as subRole in customer's external security system.
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

removeSubRole

void removeSubRole(java.lang.String realmName,
                   java.lang.String roleName,
                   java.lang.String subRole)
                   throws NoSuchRoleException,
                          JRCustomerException
Removes a sub-role from the specified parent role in customer's external security system.

Parameters:
realmName - the realm name.
roleName - the parent role name, from which a sub-role will be removed.
subRole - the sub-role name which will be removed from the specified parent role.
Throws:
NoSuchRoleException - If the specified parent role or sub-role does not exist in customer's external security system.
JRCustomerException - If an error occurs during JReport server security system invoking this method, and the implementation thinks this error should be thrown to JReport server security system.

isEnableEdit

boolean isEnableEdit()
Indicates whether customer's external security system will be modified by invoking some methods in RoleProvider.
In common cases, invoking addRole(), removeRole(), addSubRole() or removeSubRole() should take effect on customer's external security system, and cause modification of external security system, this method should return true in such cases. If customer's external security system will not be affected by invoking addRole(), removeRole(), addSubRole() or removeSubRole(), this method should return false.
Returned value of the method isEditing() with parameters SecurityWebAdaptor.ACTION_ADD_ROLE SecurityWebAdaptor.ACTION_REMOVE_ROLE SecurityWebAdaptor.ACTION_EDIT_RELATION_ROLE_SUBROLE in jet.server.api.SecurityWebAdaptor is the same as this method's return value.

Returns:
true if external security system will be affected by invoking addRole(), removeRole(), addSubRole() or removeSubRole(), otherwise return false.
See Also:
SecurityWebAdaptor