Consider extracting user-related API operations from AdminApiHandler
#380
Labels
API
back end
Involves changes to the Express application or other server-related files
enhancement
New feature or request
good first issue
Good for newcomers
I'm not entirely sure this is necessary, but there is some awkwardness with the current implementation that I wanted to document.
AdminApiHandler
has some constructor parameters and instance variables that are not used by all methods. For instance,userLoginId
is not used byAdminApiHandler.createExternalUsers
, but is byAdminApiHandler.getParentAccounts
. This leads to a situation where we have to provide defaults even when they are not used. This is likely best resolved by extracting some of the methods into a separate class, although there shouldn't be an issue with the current implementation so long as methods are used properly (i.e. defaults aren't relied upon when they should be set). Alternatively, constructor parameters could become method parameters.I originally envisioned the handler organization as being one class per Canvas API root (i.e.
courses
,sections
,accounts
), but the inclusion ofAdminApiHandler.getUserInfo
somewhat violates that (users
root). However,createExternalUser
does useaccounts
, and I'd probably try to keepcreateExternalUser
withgetUserInfo
since they are related conceptually. I could see moving both to a newUserApiHandler
class, but I'm open to other ideas.The text was updated successfully, but these errors were encountered: