com.googlecode.fascinator.roles.internal
Class InternalRoles

java.lang.Object
  extended by com.googlecode.fascinator.roles.internal.InternalRoles
All Implemented Interfaces:
Plugin, Roles

public class InternalRoles
extends Object
implements Roles

This plugin implements the Fascinator default internal roles.

Configuration

Standard configuration table:

Option Description Required Default
internal/path File path in wich the roles information is stored Yes ${user.home}/.fascinator/roles.properties

Examples

  1. Using Internal role plugin in The Fascinator
          "roles": {
              "type": "internal",
              "internal": {
                  "path": "${user.home}/.fascinator/roles.properties"
          }
     

Wiki Link

None

Author:
Greg Pendlebury

Constructor Summary
InternalRoles()
           
 
Method Summary
 void createRole(String rolename)
          Create a role.
 void deleteRole(String rolename)
          Delete a role.
 String getId()
           
 String getName()
           
 PluginDescription getPluginDetails()
          Gets a PluginDescription object relating to this plugin.
 String[] getRoles(String username)
          Find and return all roles this user has.
 String[] getUsersInRole(String role)
          Returns a list of users who have a particular role.
 void init(File jsonFile)
           
 void init(String jsonString)
           
 void removeRole(String username, String oldrole)
          Remove a role from a user.
 void renameRole(String oldrole, String newrole)
          Rename a role.
 String[] searchRoles(String search)
          Returns a list of roles matching the search.
 void setConfig(JsonSimpleConfig config)
           
 void setRole(String username, String newrole)
          Assign a role to a user.
 void shutdown()
           
 boolean supportsRoleManagement()
          Method for testing if the implementing plugin allows the creation, deletion and modification of roles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalRoles

public InternalRoles()
Method Detail

getId

public String getId()
Specified by:
getId in interface Plugin

getName

public String getName()
Specified by:
getName in interface Plugin

getPluginDetails

public PluginDescription getPluginDetails()
Gets a PluginDescription object relating to this plugin.

Specified by:
getPluginDetails in interface Plugin
Returns:
a PluginDescription

init

public void init(String jsonString)
          throws RolesException
Specified by:
init in interface Plugin
Throws:
RolesException

init

public void init(File jsonFile)
          throws RolesException
Specified by:
init in interface Plugin
Throws:
RolesException

setConfig

public void setConfig(JsonSimpleConfig config)
               throws IOException
Throws:
IOException

shutdown

public void shutdown()
              throws RolesException
Specified by:
shutdown in interface Plugin
Throws:
RolesException

getRoles

public String[] getRoles(String username)
Find and return all roles this user has.

Specified by:
getRoles in interface Roles
Parameters:
username - The username of the user.
Returns:
An array of role names (String).

getUsersInRole

public String[] getUsersInRole(String role)
Returns a list of users who have a particular role.

Specified by:
getUsersInRole in interface Roles
Parameters:
role - The role to search for.
Returns:
An array of usernames (String) that have that role.

supportsRoleManagement

public boolean supportsRoleManagement()
Method for testing if the implementing plugin allows the creation, deletion and modification of roles.

Specified by:
supportsRoleManagement in interface Roles
Returns:
true/false reponse.

setRole

public void setRole(String username,
                    String newrole)
             throws RolesException
Assign a role to a user.

Specified by:
setRole in interface Roles
Parameters:
username - The username of the user.
newrole - The new role to assign the user.
Throws:
RolesException - if there was an error during assignment.

removeRole

public void removeRole(String username,
                       String oldrole)
                throws RolesException
Remove a role from a user.

Specified by:
removeRole in interface Roles
Parameters:
username - The username of the user.
oldrole - The role to remove from the user.
Throws:
RolesException - if there was an error during removal.

createRole

public void createRole(String rolename)
                throws RolesException
Create a role.

Specified by:
createRole in interface Roles
Parameters:
rolename - The name of the new role.
Throws:
RolesException - if there was an error creating the role.

deleteRole

public void deleteRole(String rolename)
                throws RolesException
Delete a role.

Specified by:
deleteRole in interface Roles
Parameters:
rolename - The name of the role to delete.
Throws:
RolesException - if there was an error during deletion.

renameRole

public void renameRole(String oldrole,
                       String newrole)
                throws RolesException
Rename a role.

Specified by:
renameRole in interface Roles
Parameters:
oldrole - The name role currently has.
newrole - The name role is changing to.
Throws:
RolesException - if there was an error during rename.

searchRoles

public String[] searchRoles(String search)
                     throws RolesException
Returns a list of roles matching the search.

Specified by:
searchRoles in interface Roles
Parameters:
search - The search string to execute.
Returns:
An array of role names that match the search.
Throws:
RolesException - if there was an error searching.


Copyright © 2009-2012. All Rights Reserved.