org.sakaiproject.delegatedaccess.logic
Interface ProjectLogic


public interface ProjectLogic

Delegated Access's logic interface

Author:
Bryan Holladay (holladay@longsight.com)

Method Summary
 boolean addChildrenNodes(Object node, String userId, List<ListOptionSerialized> blankRestrictedTools, boolean onlyAccessNodes, List<String> accessAdminNodes, boolean shopping, boolean shoppingPeriodTool)
          Adds children node to a node that hasn't had it's children populated.
 void clearNodeCache()
          clears DelegatedAccess's own node cache
 TreeModel createAccessTreeModelForUser(String userId, boolean addDirectChildren, boolean cascade)
          returns the tree model of a user's delegated access.
 TreeModel createEntireTreeModelForUser(String userId, boolean addDirectChildren, boolean cascade)
          This returns a full tree model for a user.
 TreeModel createTreeModelForShoppingPeriod(String userId)
          returns the tree model that looks up the shopping period information for the sites the user has access to
 void deleteEmptyNonSiteNodes(String hierarchyId)
          Deletes empty non sites nodes in a hierarchy (nodes that doesn't start with /site/ and has no children)
 Set<HierarchyNodeSerialized> getAccessAdminNodesForUser(String userId)
          Returns a set of hierarchy nodes that the user has been assigned accessAdmin privileges for.
 String getAddDAMyworkspaceJobStatus()
          returns the status of the job for adding delegated access tool to user's my workspace.
 String[] getCurrentUsersAccessToSite(String siteRef)
          This returns an array of {realm, role} for which the user has delegated access to.
 List<ListOptionSerialized> getEntireToolsList()
          returns a blank (unselected) list of all the tool options for restricting tools
 TreeModel getEntireTreePlusUserPerms(String userId)
          This returns the entire tree plus any permissions set for a user
 Date getHierarchyJobLastRunDate(String nodeId)
          returns the hierarchyjoblastrundate date for the node Id and hierarchy user
 HierarchyNodeSerialized getNode(String id)
          returns a HierarchyNodeSerialized node
 NodeModel getNodeModel(String nodeId, String userId)
          This will return a fully instantiated NodeModel for that user and id.
 Map<String,List<String>> getNodesBySiteRef(String[] siteRef, String hierarchyId)
          Returns a map of {siteRef, nodeId}
 Map<String,String> getRealmRoleDisplay(boolean shopping)
          returns a map of all role options and their realm/role ids separated by a ':'.
 Map<String,AccessNode> getUserAccessForSite(String siteRef)
          Returns a map of UserId -> AccessNode
 boolean hasAccessAdminNodes(String userId)
          returns whether the user has any "access admin" permission
 boolean hasDelegatedAccessNodes(String userId)
          returns whether the user has any delegated access
 boolean hasShoppingPeriodAdminNodes(String userId)
          Returns whether the user has any shopping period admin access
 void initializeDelegatedAccessSession()
          updates the user's Session adding all of the user's site and role access to the delegatedaccess.accessmap Session attribute.
 boolean isShoppingPeriodOpenForSite(Date startDate, Date endDate, String[] nodeAccessRealmRole, String[] restrictedAuthTools, String[] restrictedPublicTools)
          Call this function to determine if the shopping period is available for a set of settings
 void removeNode(org.sakaiproject.hierarchy.model.HierarchyNode node)
          Removes this node and all permissions and children nodes
 void removeNode(String nodeId)
          Removes this node an all permissions and children nodes
 void saveHierarchyJobLastRunDate(Date runDate, String nodeId)
          Saves the date for the last time the hierarchy job ran successfully
 void scheduleAddDAMyworkspaceJobStatus()
          Schedules the AddDAMyworkspace job to run immediately
 List<SearchResult> searchUsers(String search)
          Returns a list of SearchResults for the user search
 List<SiteSearchResult> searchUserSites(String search, Map<String,String> advancedOptions, boolean shoppingPeriod, boolean activeShoppingData)
          Searches user access sites by siteId and siteTitle and props
 void syncMyworkspaceToolForUser(String userId)
          This will ensure the Delegated Access tool is synced with the user's MyWorkspace.
 void updateAddDAMyworkspaceJobStatus(String status)
          removes the old status and updates it with the string passed in
 void updateNodePermissionsForUser(DefaultMutableTreeNode node, String userId)
          Removes old user permissions and replaces it with the passed in information.
 Map<String,String> updateShoppingPeriodSettings(DefaultMutableTreeNode node)
          Call this method if you want to update a node and all it's children it will only update nodes that start with /site/
 

Method Detail

getCurrentUsersAccessToSite

String[] getCurrentUsersAccessToSite(String siteRef)
This returns an array of {realm, role} for which the user has delegated access to. If nothing is found, then it returns null. This function also updates the denied tools session map

Parameters:
siteRef -
Returns:

searchUsers

List<SearchResult> searchUsers(String search)
Returns a list of SearchResults for the user search

Parameters:
search -
first -
last -
Returns:

updateNodePermissionsForUser

void updateNodePermissionsForUser(DefaultMutableTreeNode node,
                                  String userId)
Removes old user permissions and replaces it with the passed in information.

Parameters:
nodeModel -
userId -

initializeDelegatedAccessSession

void initializeDelegatedAccessSession()
updates the user's Session adding all of the user's site and role access to the delegatedaccess.accessmap Session attribute. This controls the user's permissions for that site. If the nodeId doesn't have an access role specified, it will grant the inherited access role.


searchUserSites

List<SiteSearchResult> searchUserSites(String search,
                                       Map<String,String> advancedOptions,
                                       boolean shoppingPeriod,
                                       boolean activeShoppingData)
Searches user access sites by siteId and siteTitle and props

Parameters:
search -
advancedOptions -
shoppingPeriod -
activeShoppingData -
Returns:

createAccessTreeModelForUser

TreeModel createAccessTreeModelForUser(String userId,
                                       boolean addDirectChildren,
                                       boolean cascade)
returns the tree model of a user's delegated access. Each node in the tree has the NodeModel object completely initialized.

Parameters:
userId -
addDirectChildren -
cascade -
Returns:

createEntireTreeModelForUser

TreeModel createEntireTreeModelForUser(String userId,
                                       boolean addDirectChildren,
                                       boolean cascade)
This returns a full tree model for a user. It will reference both their access and shopping period admin permissions.

Parameters:
userId -
addDirectChildren -
cascade -
Returns:

createTreeModelForShoppingPeriod

TreeModel createTreeModelForShoppingPeriod(String userId)
returns the tree model that looks up the shopping period information for the sites the user has access to

Parameters:
userId -
Returns:

addChildrenNodes

boolean addChildrenNodes(Object node,
                         String userId,
                         List<ListOptionSerialized> blankRestrictedTools,
                         boolean onlyAccessNodes,
                         List<String> accessAdminNodes,
                         boolean shopping,
                         boolean shoppingPeriodTool)
Adds children node to a node that hasn't had it's children populated. This is used to increase the efficiency of the tree so you can create the structure on the fly with ajax

Parameters:
node -
userId -
blankRestrictedTools -
onlyAccessNodes -
accessAdminNodes -
shopping -
shoppingPeriodTool -
Returns:

getEntireToolsList

List<ListOptionSerialized> getEntireToolsList()
returns a blank (unselected) list of all the tool options for restricting tools

Returns:

getNodeModel

NodeModel getNodeModel(String nodeId,
                       String userId)
This will return a fully instantiated NodeModel for that user and id. It will look up it's parents nodes and instantiate them as well.

Parameters:
nodeId -
userId -
Returns:

getNode

HierarchyNodeSerialized getNode(String id)
returns a HierarchyNodeSerialized node

Parameters:
id -
Returns:

getEntireTreePlusUserPerms

TreeModel getEntireTreePlusUserPerms(String userId)
This returns the entire tree plus any permissions set for a user

Parameters:
userId -
Returns:

hasShoppingPeriodAdminNodes

boolean hasShoppingPeriodAdminNodes(String userId)
Returns whether the user has any shopping period admin access

Parameters:
userId -
Returns:

hasDelegatedAccessNodes

boolean hasDelegatedAccessNodes(String userId)
returns whether the user has any delegated access

Parameters:
userId -
Returns:

hasAccessAdminNodes

boolean hasAccessAdminNodes(String userId)
returns whether the user has any "access admin" permission

Parameters:
userId -
Returns:

getNodesBySiteRef

Map<String,List<String>> getNodesBySiteRef(String[] siteRef,
                                           String hierarchyId)
Returns a map of {siteRef, nodeId}

Parameters:
siteRef -
hierarchyId -
Returns:

saveHierarchyJobLastRunDate

void saveHierarchyJobLastRunDate(Date runDate,
                                 String nodeId)
Saves the date for the last time the hierarchy job ran successfully

Parameters:
runDate -
nodeId -

getHierarchyJobLastRunDate

Date getHierarchyJobLastRunDate(String nodeId)
returns the hierarchyjoblastrundate date for the node Id and hierarchy user

Parameters:
nodeId -
Returns:

removeNode

void removeNode(String nodeId)
Removes this node an all permissions and children nodes

Parameters:
nodeId -

removeNode

void removeNode(org.sakaiproject.hierarchy.model.HierarchyNode node)
Removes this node and all permissions and children nodes

Parameters:
node -

deleteEmptyNonSiteNodes

void deleteEmptyNonSiteNodes(String hierarchyId)
Deletes empty non sites nodes in a hierarchy (nodes that doesn't start with /site/ and has no children)

Parameters:
hierarchyId -

clearNodeCache

void clearNodeCache()
clears DelegatedAccess's own node cache


getRealmRoleDisplay

Map<String,String> getRealmRoleDisplay(boolean shopping)
returns a map of all role options and their realm/role ids separated by a ':'. For example: Instructor => !site.template.course:Instructor

Parameters:
shopping -
Returns:

getAccessAdminNodesForUser

Set<HierarchyNodeSerialized> getAccessAdminNodesForUser(String userId)
Returns a set of hierarchy nodes that the user has been assigned accessAdmin privileges for.

Parameters:
userId -
Returns:

isShoppingPeriodOpenForSite

boolean isShoppingPeriodOpenForSite(Date startDate,
                                    Date endDate,
                                    String[] nodeAccessRealmRole,
                                    String[] restrictedAuthTools,
                                    String[] restrictedPublicTools)
Call this function to determine if the shopping period is available for a set of settings

Parameters:
startDate -
endDate -
nodeAccessRealmRole -
restrictedAuthTools -
restrictedPublicTools -
Returns:

syncMyworkspaceToolForUser

void syncMyworkspaceToolForUser(String userId)
This will ensure the Delegated Access tool is synced with the user's MyWorkspace. Another words, if the user has no permissions in DA, then the tool will be removed from the user's My Workspace. If they are granted access somewhere, then this will add the tool to thier My Workspace this is turned on/off by a sakai.property delegatedaccess.sync.myworkspacetool

Parameters:
userId -

getUserAccessForSite

Map<String,AccessNode> getUserAccessForSite(String siteRef)
Returns a map of UserId -> AccessNode

Parameters:
siteRef -
Returns:

updateShoppingPeriodSettings

Map<String,String> updateShoppingPeriodSettings(DefaultMutableTreeNode node)
Call this method if you want to update a node and all it's children it will only update nodes that start with /site/

Parameters:
node -
Returns:
a map of errors and the stack trace

getAddDAMyworkspaceJobStatus

String getAddDAMyworkspaceJobStatus()
returns the status of the job for adding delegated access tool to user's my workspace. This can be null or a string

Returns:

updateAddDAMyworkspaceJobStatus

void updateAddDAMyworkspaceJobStatus(String status)
removes the old status and updates it with the string passed in

Parameters:
status -

scheduleAddDAMyworkspaceJobStatus

void scheduleAddDAMyworkspaceJobStatus()
Schedules the AddDAMyworkspace job to run immediately



Copyright © 2003-2012 Sakai Project. All Rights Reserved.