Show:

I contain all business logic about the UserManagement.

I control both the UI as well as the data model for user management (registration, settings, administration) and the user login.

Methods

closeAdministrationBox

()

I close the user administration dialog (jQuery UI Dialog).

Returns:

closeLoginBox

()

I close the login box.

ensureAuthenticated

(
  • callback
  • callbackCancel
  • disallowCancel
)

Sometimes a routine should only execute, if we can ensure the user is logged in at this point.

I serve this purpose, by checking wether the user has already logged in, and if not provide him the chance to login (or even create an account first).

After the user has logged in I call the callback (the routine which shall execute only with a logged-in user).

If the user aborted the offer to login, an optional cancelCallback can be called.

Parameters:

isLoggedIn

(
  • callback
)

I check wether the user has logged in, and call the callback with a boolean to indicate this.

Parameters:

login

(
  • userData
)
private

I am called to update my local and gloabl state after the server has created a login session.

Parameters:

logout

()

I am called to close the login session and update my local and global state.

showAdministrationBox

()

I open the user administration dialog. The UI is a single DOM element, which is displayed via jQuery UI Dialog

showLoginBox

(
  • disallowCancel
)

I open the login box. The UI is a single DOM element

Parameters:

updateAdministration

() private

I update the UI elements of the tab Administration

(WAS MOVED AT A WRONG PLACE)

updateSettings

() private

I update the UI elements of the tab Settings

updateView

(
  • loginStatus
)
private

The UI of the UserManagement has to be updated, when the loginStatus changes.

I check wether the user is an admin or a normal user, and show and hide the respective tabs (Settings and Administration) accordingly.

Parameters:

Attributes

userID

The current userID or an empty String.

userMail

The users mail adress as a String.

userRegistrationDate

The users registration Date, which is a Number (milliseconds since 01-01-1970)

userRole

The users role, which is either 'admin' or 'user', or – when not logged in – an empty String.