Administration Agent - User Operations

These are the operations that are directly involved in User¹ management.
To check the other agent operations, please look at the Administration Agent definition.

1) Data Contracts

(Due to CodePlex limitations we're not allowed to show the same image as in Administration Agent. Please help us change it and vote in this workitem: Linking to images outside of the Wiki?)

2) Operations

2.1) User CreateUser(User user, Role[] roles, Membership membership, String password)

Description

This method is responsible for creating an User¹ in the security repository with the given password and associates the user to the application, to the membership and to the specified roles.

Parameters

  • User user - The user being created.
  • Role[] - Array of roles that this user will be associated to. If the role exists the user will be associated, otherwise the role will be created in the current authenticated application.
  • Membership - Membership data for the given user.
  • String password - The password to be used for authenticating the given user. Please advise that only a hash of the password will be saved in the Digital Fortress Security Repository, and as such there's no way of retrieving this password. You can reset it though.

Returns

  • User - Returns the newly created user.

Dependencies

Test Suite:

  1. Test successful creation.
  2. Test creation of a null user, resulting in an expected fault (UserRequiredFault).
  3. Test creation of an user with null or empty username, resulting in an expected fault (UsernameRequiredFault).
  4. Test creation of an user with the same username as an existing one in the same application, resulting in an expected fault (UserAlreadyExistsFault).
  5. Test creation of an user with no roles, resulting in an expected fault (RolesRequiredFault).
  6. Test creation of an user with null membership data, resulting in an expected fault (MembershipRequiredFault).
  7. Test creation of an user with null or empty password, resulting in an expected fault (PasswordRequiredFault).
  8. Test creation of an user with null or empty e-mail, resulting in an expected fault (EmailRequiredFault).

2.2) Int64 RetrieveUserCount()

Description

This method is responsible for retrieving the number of User¹ objects in the security repository for the current application.

Parameters

  • None.

Returns

  • Int64 - Returns the user count for the current application.

Dependencies

Test Suite:

  1. Test successful retrieval. Test this with at least two users.
  2. Test successful retrieval. Test this with no users.

2.3) User RetrieveUser(Guid userId)

Description

This method is responsible for retrieving an User¹ in the security repository based on its unique id.

Parameters

  • Guid userId - The user id to be retrieved.

Returns

  • User - Returns the retrieved user. Returns null if the user doesn't exist.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of an user with Guid.Empty id, resulting in an expected fault (UserRequiredFault).

2.4) User RetrieveUserByUsername(String username)

Description

This method is responsible for retrieving an User¹ in the security repository based on its username.

Parameters

  • String username - The username of the user to be retrieved.

Returns

  • User - Returns the retrieved user. Returns null if the user doesn't exist.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of an user with null or empty username, resulting in an expected fault (UserNameRequiredFault).

2.5) User RetrieveUserByEmail(String email)

Description

This method is responsible for retrieving an User¹ in the security repository based on its e-mail.

Parameters

  • String email - The e-mail of the user to be retrieved.

Returns

  • User - Returns the retrieved user. Returns null if the user doesn't exist.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of an user with null or empty e-mail, resulting in an expected fault (EmailRequiredFault).

2.6) User[] RetrieveAllUsers()

Description

This method is responsible for retrieving all User¹ objects in the security repository based on the current application.

Parameters

  • None.

Returns

  • User[] - Returns an array of all the users in the current application.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test successful retrieval with no users.

2.7) User[] RetrieveSlicedUsers(Int32 currentPage, Int32 pageSize))

Description

This method is responsible for retrieving the User¹ objects in the security repository based on the current application, paged using the currentPage and pageSize.

Parameters

  • Int32 currentPage - Current page.
  • Int32 pageSize - The number of items to return for the current page.

Returns

  • User[] - Returns an array of the users in the current application, in the given page.

Dependencies

Test Suite:

  1. Test successful retrieval with at least 5 users. Retrieve currentPage 1 with pageSize 3, and currentPage 2 with pageSize 3. In the first query the return must containt 3 users, in the second query the return must contain 2 users.
  2. Test retrieval with pageSize equal to 0, resulting in an expected fault (InvalidPageSizeFault).
  3. Test retrieval with currentPage equal to 0, resulting in an expected fault (InvalidCurrentPageFault).
  4. Test retrieval of an invalid page. Using the first test case, try to retrieve page 3, resulting in an expected fault (PageOutOfRangeFault).

2.8) User[] RetrieveUsersByRole(Role role)

Description

This method is responsible for retrieving all User¹ objects that a given user has.

Parameters

  • Role role - Role to get users from.

Returns

  • User[] - Returns all the users associated to that role. May be an empty array.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of all users with null role, resulting in an expected fault (RoleRequiredFault).
  3. Test retrieval of all users with a role with a not existing id, resulting in an expected fault (RoleNotFoundFault).

2.9) User UpdateUser(User user, Membership membership)

Description

This method is responsible for updating an User¹ and his Membership¹ in the security repository.

Parameters

  • User user - The user being updated.
  • Membership membership - Membership data for the given user.

Returns

  • User - Returns the updated user.

Dependencies

Test Suite:

  1. Test successful updating.
  2. Test updating a null user, resulting in an expected fault (UserRequiredFault).
  3. Test updating an user with null or empty username, resulting in an expected fault (UsernameRequiredFault).
  4. Test updating an user with the same username as an existing one in the same application, resulting in an expected fault (UserAlreadyExistsFault).
  5. Test updating an user with null membership data, resulting in an expected fault (MembershipRequiredFault).
  6. Test updating an user with null or empty e-mail, resulting in an expected fault (EmailRequiredFault).

2.10) void BlockUser(User user)

Description

This method is responsible for blocking an User¹'s access. Authentication will fail for this user.

Parameters

  • User user - The user being blocked.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful blocking. This must call the AuthenticateAgent to verify that the user IS BLOCKED.
  2. Test blocking a null user, resulting in an expected fault (UserRequiredFault).
  3. Test blocking an user with invalid id, resulting in an expected fault (UserNotFoundFault).
  4. Test blocking a blocked user, resulting in an expected fault (UserAlreadyBlockedFault).

2.11) void UnblockUser(User user)

Description

This method is responsible for unblocking an User¹'s access. Authentication must not fail for this user.

Parameters

  • User user - The user being unblocked.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful unblocking. This must call the AuthenticateAgent to verify that the user IS UNBLOCKED.
  2. Test unblocking a null user, resulting in an expected fault (UserRequiredFault).
  3. Test unblocking an user with invalid id, resulting in an expected fault (UserNotFoundFault).
  4. Test unblocking an unblocked user, resulting in an expected fault (UserAlreadyUnblockedFault).

2.12) void AssignRolesToUser(User user, Role[] role)

Description

This method is responsible for assigning one or more Role¹'s to an User¹. If one of the roles being assigned is already assigned it's ignored.

Parameters

  • User user - The user being assigned.
  • Role[] role - The roles being assigned.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful assigning.
  2. Test assigning roles to a null user, resulting in an expected fault (UserRequiredFault).
  3. Test assigning roles to an user with invalid id, resulting in an expected fault (UserNotFoundFault).
  4. Test assigning a null or empty array of roles to an user, resulting in an expected fault (RolesRequiredFault).
  5. Test assigning a role that doesn't exist, resulting in an expected fault (RoleNotFoundFault).

2.13) void UnassignRolesToUser(User user, Role[] role)

Description

This method is responsible for unassigning one or more Role¹'s to an User¹. If one of the roles being unassigned is already unassigned it's ignored.

Parameters

  • User user - The user being unassigned.
  • Role[] role - The roles being unassigned.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful unassigning.
  2. Test unassigning roles to a null user, resulting in an expected fault (UserRequiredFault).
  3. Test unassigning roles to an user with invalid id, resulting in an expected fault (UserNotFoundFault).
  4. Test unassigning a null or empty array of roles to an user, resulting in an expected fault (RolesRequiredFault).
  5. Test unassigning a role that doesn't exist, resulting in an expected fault (RoleNotFoundFault).

2.14) void ReplaceUserRoles(User user, Role[] role)

Description

This method is responsible for replacing all User¹ Roles¹. Before assigning the roles, all roles are disassociated from the User.

Parameters

  • User user - The user having roles replaced.
  • Role[] role - The roles having roles replaced.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful replacement.
  2. Test replacing roles of a null user, resulting in an expected fault (UserRequiredFault).
  3. Test replacing roles of an user with invalid id, resulting in an expected fault (UserNotFoundFault).
  4. Test replacing a null or empty array of roles of an user, resulting in an expected fault (RolesRequiredFault).
  5. Test replacing a role that doesn't exist of an user, resulting in an expected fault (RoleNotFoundFault).

2.15) void DeleteUser(User user)

Description

This method is responsible for deleting an User¹ from the security repository.
PLEASE ADVISE THAT ALL MEMBERSHIP DATA AND ALL ASSOCIATIONS WITH ROLES WILL BE DELETED.

Parameters

  • User user - The user being deleted.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful deletion. (This test must verify that all associations with roles have been removed as well)
  2. Test deleting an user that does not exist (invalid userId), resulting in an expected fault (UserNotFoundFault).
  3. Test deleting a null user, resulting in an expected fault (UserRequiredFault).

2.16) User UpdateUserPassword(User user, String oldPassword, String newPassword)

Description

This method is responsible for changing an User¹'s password to the given password.

Parameters

  • User user - The user being updated.
  • String oldPassword - The current password. Please advise that this password MUST match the current one, or else a fault will be returned.
  • String newPassword - The new password.

Returns

  • User - Returns the updated user.

Dependencies

  • 2.1 - Test successful creation.

Test Suite:

  1. Test successful updating.
  2. Test updating the password of a null user, resulting in an expected fault (UserRequiredFault).
  3. Test updating the password of an user that doesn't exist, resulting in an expected fault (UserNotFoundFault).
  4. Test updating the password using a wrong current password, resulting in an expected fault (InvalidCurrentPasswordFault).
  5. Test updating the password using a blank new password, resulting in an expected fault (PasswordRequiredFault).

2.17) void ResetUserPassword(Guid userId)

Description

This method is responsible for reseting an User¹'s password to a random password. Test that an e-mail with the correct template is sent to the user.

Parameters

  • Guid userId - The user id being reset.

Returns

  • void.

Dependencies

  • 2.1 - Test successful creation.

Test Suite:

  1. Test successful reset. Verify that the e-mail has reached the user.
  2. Test resetting the password of a Guid.Empty user, resulting in an expected fault (UserRequiredFault).
  3. Test resetting the password of an user that doesn't exist, resulting in an expected fault (UserNotFoundFault).

¹Please refer to the Data Contracts image for clarifications on this contract.

Last edited Jun 20, 2007 at 3:57 AM by Heynemann, version 13

Comments

No comments yet.