com.konakartadmin.blif
Interface AdminSecurityMgrIf

All Known Implementing Classes:
AdminSecurityMgr, AdminSecurityMgrEE

public interface AdminSecurityMgrIf

AdminSecurityMgrIf


Method Summary
 void addApiCallsToRole(AdminApiCall[] apiCalls, int roleId)
          Adds the array of AdminApiCall objects to the role identified by the roleId parameter.
 void addCustomDataToSession(java.lang.String sessionId, java.lang.String data, int position)
          A sessionId is created when a customer logs in to KonaKart using the login() API call.
 void addPanelsToRole(AdminPanel[] panels, int roleId)
          Adds the array of AdminPanel objects to the role identified by the roleId parameter.
 void addRolesToUser(AdminRole[] roles, int userId)
          Adds the array of AdminRole objects to the user identified by the userId parameter.
 void changePassword(int custId, java.lang.String currentPassword, java.lang.String newPassword)
          The method ensures that the current password is correct, and then changes it with the new password.
 int checkSession(java.lang.String sessionId, java.lang.String apiCall)
          The given sessionId is checked to see whether it exists and whether it is has timed out.
 void deleteApiCall(int apiCallId)
          Deletes the apiCallId identified by the apiCallId parameter.
 int deleteExpiredSessions()
          Deletes all sessions that have expired.
 void deletePanel(int panelId)
          Deletes the panel identified by the panelId parameter.
 void deleteRole(int roleId)
          Deletes the role identified by the roleId parameter.
 void editApiCall(AdminApiCall apiCall)
          Edit an ApiCall.
 void editPanel(AdminPanel panel)
          Edit a Panel.
 void editRole(AdminRole role)
          Edit a Role.
 java.lang.String encrypt(java.lang.String password)
          Generates a random byte which it concatenates with the password placing it in front (i.e.
 AdminApiCall[] getAllApiCalls()
          Retrieves all apiCalls in an array
 AdminPanel[] getAllPanels()
          Retrieves all panels in an array
 AdminRole[] getAllRoles()
          Returns all roles
 AdminApiCall getApiCall(int apiCallId)
          Returns the AdminApiCall referenced by the apiCallId.
 AdminApiCall[] getApiCallsPerRole(int roleId)
          Retrieves an array of AdminApiCall objects for the role.
 java.lang.String getCustomDataFromSession(java.lang.String sessionId, int position)
          A sessionId is created when a customer logs in to KonaKart using the login() API call.
 AdminPanel getPanel(int panelId)
          Returns the AdminPanel referenced by the panelId.
 AdminPanel[] getPanelsPerRole(int roleId)
          Retrieves an array of AdminPanel objects for the role.
 AdminRole getRole(int roleId)
          Returns the AdminRole referenced by the roleId.
 AdminRole[] getRolesPerUser(int userId)
          Retrieves an array of AdminRole objects for the user.
 AdminSession getSession(java.lang.String sessionId)
          Retrieves the session object for the specified sessionId
 int getTimeInSecs()
          Utility method to return the current time in minutes
 int insertApiCall(AdminApiCall apiCall)
          Insert a new apiCall.
 int insertPanel(AdminPanel panel)
          Insert a new Panel.
 int insertRole(AdminRole role)
          Insert a new Role.
 boolean isSuperUser(int userId)
          Returns true if the user has a superUser role otherwise false
 java.lang.String login(java.lang.String user, java.lang.String password)
          Returns a session id if successful.
 void logout(java.lang.String sessionId)
          Used to logout the user with the specified sessionId
 void refreshConfigs()
          Refresh the configuration of the Admin Currency Manager
 void removeApiCallsFromRole(AdminApiCall[] apiCalls, int roleId)
          Removes the array of AdminApiCall objects from the role identified by the roleId parameter.
 void removePanelsFromRole(AdminPanel[] panels, int roleId)
          Removes the array of AdminPanel objects from the role identified by the roleId parameter.
 void removeRolesFromUser(AdminRole[] roles, int userId)
          Removes the array of AdminRole objects from the user identified by the userId parameter.
 

Method Detail

login

java.lang.String login(java.lang.String user,
                       java.lang.String password)
                       throws java.lang.Exception
Returns a session id if successful. Otherwise returns null.

Parameters:
user -
password -
Returns:
SessionId if OK. Otherwise null.
Throws:
java.lang.Exception

logout

void logout(java.lang.String sessionId)
            throws java.lang.Exception
Used to logout the user with the specified sessionId

Parameters:
sessionId - The session Id of the logged in user
Throws:
java.lang.Exception

getSession

AdminSession getSession(java.lang.String sessionId)
                        throws java.lang.Exception
Retrieves the session object for the specified sessionId

Parameters:
sessionId - the session to read
Returns:
Returns the AdminSession object for the session
Throws:
java.lang.Exception

checkSession

int checkSession(java.lang.String sessionId,
                 java.lang.String apiCall)
                 throws java.lang.Exception
The given sessionId is checked to see whether it exists and whether it is has timed out. If it is valid, the expiry attribute is updated. If the apiCall is not null, we also check for API Call security.

Parameters:
sessionId -
apiCall -
Returns:
Returns customerId
Throws:
java.lang.Exception

changePassword

void changePassword(int custId,
                    java.lang.String currentPassword,
                    java.lang.String newPassword)
                    throws java.lang.Exception
The method ensures that the current password is correct, and then changes it with the new password. It allows any password length and relies on the application to ensure that a minimum length is guaranteed.

Parameters:
custId - the customer Id of the customer whose password to change
currentPassword - current password
newPassword - new password
Throws:
java.lang.Exception

deleteExpiredSessions

int deleteExpiredSessions()
                          throws org.apache.torque.TorqueException,
                                 com.workingdogs.village.DataSetException,
                                 KKAdminException
Deletes all sessions that have expired. Returns the number of non expired sessions.

Returns:
Returns the number of remaining sessions
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getTimeInSecs

int getTimeInSecs()
Utility method to return the current time in minutes

Returns:
Returns the time

encrypt

java.lang.String encrypt(java.lang.String password)
                         throws java.security.NoSuchAlgorithmException
Generates a random byte which it concatenates with the password placing it in front (i.e. "randomByte" + "Password"). Once the string has been encrypted it is returned as "encrypted string" : "random byte" . For example : password = secret and random byte = ce, then we encrypt cesecret . If the result is "51fc1050abe9ce692565814ac52a9ed2" we return 51fc1050abe9ce692565814ac52a9ed2:ce

Parameters:
password -
Returns:
Returns an encrypted password
Throws:
java.security.NoSuchAlgorithmException

getRolesPerUser

AdminRole[] getRolesPerUser(int userId)
                            throws org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException,
                                   KKAdminException
Retrieves an array of AdminRole objects for the user. Each AdminRole object will contain an array of AdminPanel objects and AdminApiCall objects if defined.

Parameters:
userId - the userId of the user whose roles & panels are returned. If the userId is 0, all roles and all panels are returned.
Returns:
Returns an array of roles with AdmnPanel and AdminApiCall objects attached if defined
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

isSuperUser

boolean isSuperUser(int userId)
                    throws KKAdminException
Returns true if the user has a superUser role otherwise false

Parameters:
userId - the userId (customerId) of the user to check
Returns:
Return true if the user is a Super User
Throws:
KKAdminException

getAllRoles

AdminRole[] getAllRoles()
                        throws org.apache.torque.TorqueException,
                               com.workingdogs.village.DataSetException,
                               KKAdminException
Returns all roles

Returns:
Returns an array of roles
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getPanelsPerRole

AdminPanel[] getPanelsPerRole(int roleId)
                              throws org.apache.torque.TorqueException,
                                     com.workingdogs.village.DataSetException,
                                     KKAdminException
Retrieves an array of AdminPanel objects for the role.

Parameters:
roleId -
Returns:
Returns an array of panels
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getApiCallsPerRole

AdminApiCall[] getApiCallsPerRole(int roleId)
                                  throws org.apache.torque.TorqueException,
                                         com.workingdogs.village.DataSetException,
                                         KKAdminException
Retrieves an array of AdminApiCall objects for the role.

Parameters:
roleId -
Returns:
Returns an array of adminApiCalls
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getAllPanels

AdminPanel[] getAllPanels()
                          throws org.apache.torque.TorqueException,
                                 com.workingdogs.village.DataSetException,
                                 KKAdminException
Retrieves all panels in an array

Returns:
Returns an array of panels
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getAllApiCalls

AdminApiCall[] getAllApiCalls()
                              throws org.apache.torque.TorqueException,
                                     com.workingdogs.village.DataSetException,
                                     KKAdminException
Retrieves all apiCalls in an array

Returns:
Returns an array of apiCalls
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

insertRole

int insertRole(AdminRole role)
               throws org.apache.torque.TorqueException,
                      KKAdminException
Insert a new Role. The role name is mandatory.

Parameters:
role -
Returns:
Returns the id of the inserted AdminRole object
Throws:
org.apache.torque.TorqueException
KKAdminException

editRole

void editRole(AdminRole role)
              throws org.apache.torque.TorqueException,
                     KKAdminException
Edit a Role. Only the role name and the role description can be modified. All other attributes are ignored.

Parameters:
role -
Throws:
org.apache.torque.TorqueException
KKAdminException

getRole

AdminRole getRole(int roleId)
                  throws org.apache.torque.TorqueException,
                         com.workingdogs.village.DataSetException,
                         KKAdminException
Returns the AdminRole referenced by the roleId.

Parameters:
roleId -
Returns:
Returns an AdminRole object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

deleteRole

void deleteRole(int roleId)
                throws org.apache.torque.TorqueException,
                       KKAdminException
Deletes the role identified by the roleId parameter. All customers_to_role and role_to_panel and role_to_api_call records are also deleted.

Parameters:
roleId -
Throws:
org.apache.torque.TorqueException
KKAdminException

addRolesToUser

void addRolesToUser(AdminRole[] roles,
                    int userId)
                    throws java.lang.Exception
Adds the array of AdminRole objects to the user identified by the userId parameter. The roles must already exist in the database.

Parameters:
roles -
userId -
Throws:
java.lang.Exception

removeRolesFromUser

void removeRolesFromUser(AdminRole[] roles,
                         int userId)
                         throws java.lang.Exception
Removes the array of AdminRole objects from the user identified by the userId parameter.

Parameters:
roles -
userId -
Throws:
java.lang.Exception

insertPanel

int insertPanel(AdminPanel panel)
                throws org.apache.torque.TorqueException,
                       KKAdminException
Insert a new Panel. The panel code is mandatory and the panel description is optional. All other attributes are ignored.

Parameters:
panel -
Returns:
Returns the id of the inserted AdminPanel object
Throws:
org.apache.torque.TorqueException
KKAdminException

insertApiCall

int insertApiCall(AdminApiCall apiCall)
                  throws org.apache.torque.TorqueException,
                         KKAdminException
Insert a new apiCall. The apiCall name is mandatory and the apiCall description is optional. All other attributes are ignored.

Parameters:
apiCall -
Returns:
Returns the id of the inserted AdminPanel object
Throws:
org.apache.torque.TorqueException
KKAdminException

editPanel

void editPanel(AdminPanel panel)
               throws org.apache.torque.TorqueException,
                      KKAdminException
Edit a Panel. Only the panel code and the panel description can be modified. All other attributes are ignored.

Parameters:
panel -
Throws:
org.apache.torque.TorqueException
KKAdminException

editApiCall

void editApiCall(AdminApiCall apiCall)
                 throws org.apache.torque.TorqueException,
                        KKAdminException
Edit an ApiCall. Only the apiCall name and the apiCall description can be modified. All other attributes are ignored.

Parameters:
apiCall -
Throws:
org.apache.torque.TorqueException
KKAdminException

deletePanel

void deletePanel(int panelId)
                 throws org.apache.torque.TorqueException,
                        KKAdminException
Deletes the panel identified by the panelId parameter. All role_to_panel records are also deleted.

Parameters:
panelId -
Throws:
org.apache.torque.TorqueException
KKAdminException

deleteApiCall

void deleteApiCall(int apiCallId)
                   throws org.apache.torque.TorqueException,
                          KKAdminException
Deletes the apiCallId identified by the apiCallId parameter. All role_to_api_call records are also deleted.

Parameters:
apiCallId -
Throws:
org.apache.torque.TorqueException
KKAdminException

getPanel

AdminPanel getPanel(int panelId)
                    throws org.apache.torque.TorqueException,
                           com.workingdogs.village.DataSetException,
                           KKAdminException
Returns the AdminPanel referenced by the panelId.

Parameters:
panelId -
Returns:
Returns an AdminPanel object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

getApiCall

AdminApiCall getApiCall(int apiCallId)
                        throws org.apache.torque.TorqueException,
                               com.workingdogs.village.DataSetException,
                               KKAdminException
Returns the AdminApiCall referenced by the apiCallId.

Parameters:
apiCallId -
Returns:
Returns an AdminApiCall object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException

addPanelsToRole

void addPanelsToRole(AdminPanel[] panels,
                     int roleId)
                     throws KKAdminException,
                            org.apache.torque.TorqueException,
                            com.workingdogs.village.DataSetException
Adds the array of AdminPanel objects to the role identified by the roleId parameter. The panel identified by panelId for each panel, and the role identified by the roleId, must already exist in the database. The panel name and description are ignored.

Parameters:
panels -
roleId -
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addApiCallsToRole

void addApiCallsToRole(AdminApiCall[] apiCalls,
                       int roleId)
                       throws KKAdminException,
                              org.apache.torque.TorqueException,
                              com.workingdogs.village.DataSetException
Adds the array of AdminApiCall objects to the role identified by the roleId parameter. The apiCall identified by apiCallId for each apiCall, and the role identified by the roleId, must already exist in the database. The apiCall name and description are ignored.

Parameters:
apiCalls -
roleId -
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

removePanelsFromRole

void removePanelsFromRole(AdminPanel[] panels,
                          int roleId)
                          throws KKAdminException,
                                 org.apache.torque.TorqueException,
                                 com.workingdogs.village.DataSetException
Removes the array of AdminPanel objects from the role identified by the roleId parameter.

Parameters:
panels -
roleId -
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

removeApiCallsFromRole

void removeApiCallsFromRole(AdminApiCall[] apiCalls,
                            int roleId)
                            throws KKAdminException,
                                   org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException
Removes the array of AdminApiCall objects from the role identified by the roleId parameter.

Parameters:
apiCalls -
roleId -
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

refreshConfigs

void refreshConfigs()
                    throws KKAdminException
Refresh the configuration of the Admin Currency Manager

Throws:
KKAdminException

addCustomDataToSession

void addCustomDataToSession(java.lang.String sessionId,
                            java.lang.String data,
                            int position)
                            throws org.apache.torque.TorqueException,
                                   KKAdminException
A sessionId is created when a customer logs in to KonaKart using the login() API call. This sessionId is persisted in the database in a table which has 5 custom fields. This method allows you to store data in these custom fields which can later be retrieved by using the sessionId as the key.

Parameters:
sessionId - The sessionId
data - The data to be saved
position - This must be in the range of 1-5 to identify custom1 to custom5
Throws:
org.apache.torque.TorqueException
KKAdminException

getCustomDataFromSession

java.lang.String getCustomDataFromSession(java.lang.String sessionId,
                                          int position)
                                          throws KKAdminException,
                                                 org.apache.torque.TorqueException,
                                                 com.workingdogs.village.DataSetException
A sessionId is created when a customer logs in to KonaKart using the login() API call. This sessionId is persisted in the database in a table which has 5 custom fields. This method allows you to retrieve the data in these custom fields by passing the sessionId as the key and a pointer to identify the custom field to be used.

Parameters:
sessionId - The sessionId
position - This must be in the range of 1-5 to identify custom1 to custom5
Returns:
Returns the custom data
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException


Copyright © 2011 DS Data Systems UK Ltd.