Administration Agent - Role Operations

These are the operations that are directly involved in Role¹ 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) Role CreateRole(Role role)

Description

This method is responsible for creating a role.

Parameters

  • Role role - The role being created.

Returns

  • Role - Returns the newly created role.

Dependencies

Test Suite:

  1. Test successful creation of role.
  2. Test creation of a null role, resulting in an expected fault (RoleRequiredFault).
  3. Test creation of two roles with the same name, resulting in an expected fault (RoleAlreadyExistsFault).
  4. Test creation of a role with no name, resulting in an expected fault (NameArgumentRequiredFault).

2.2) Int64 RetrieveRoleCount()

Description

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

Parameters

  • None.

Returns

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

Dependencies

Test Suite:

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

2.3) Role RetrieveRole(Guid roleId)

Description

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

Parameters

  • Guid roleId - The role id to be retrieved.

Returns

  • Role - Returns the retrieved role. If the guid doesn't exist returns null.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of a role with Guid.Empty id, resulting in an expected fault (RoleRequiredFault).

2.4) Role RetrieveRoleByName(String roleName)

Description

This method is responsible for retrieving a Role¹ in the security repository based on its name.

Parameters

  • String roleName - The name of the role to be retrieved.

Returns

  • Role - Returns the retrieved role. If the role doesn't exist returns null.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of a role with null or empty name, resulting in an expected fault (NameRequiredFault).

2.5) Role[] RetrieveAllRoles()

Description

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

Parameters

  • None.

Returns

  • Role[] - Returns an array of all the roles in the current application.

Dependencies

Test Suite:

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

2.6) Role[] RetrieveSlicedRoles(Int32 currentPage, Int32 pageSize))

Description

This method is responsible for retrieving the Role¹ 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

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

Dependencies

Test Suite:

  1. Test successful retrieval with at least 5 roles. Retrieve currentPage 1 with pageSize 3, and currentPage 2 with pageSize 3. In the first query the return must containt 3 roles, in the second query the return must contain 2 roles.
  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.7) Role[] RetrieveRolesByUser(User user)

Description

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

Parameters

  • User user - User to get roles from.

Returns

  • Role[] - Returns all the roles associated to that user. May be an empty array.

Dependencies

Test Suite:

  1. Test successful retrieval.
  2. Test retrieval of all roles with null user, resulting in an expected fault (UserRequiredFault).
  3. Test retrieval of all roles with a user with a not existing id, resulting in an expected fault (UserNotFoundFault).

2.8) Role UpdateRole(Role role)

Description

This method is responsible for updating a Role¹ in the security repository.

Parameters

  • Role role - The role being updated.

Returns

  • Role - Returns the updated role.

Dependencies

Test Suite:

  1. Test successful updating.
  2. Test updating a null role, resulting in an expected fault (RoleRequiredFault).
  3. Test updating a role that does not exist (invalid roleId), resulting in an expected fault (RoleNotFoundFault).
  4. Test updating a role to have the same name of an existing one, resulting in an expected fault (RoleAlreadyExistsFault).
  5. Test updating a role with blank name, resulting in an expected fault (NameArgumentRequiredFault).

2.9) void DeleteRole(Role role)

Description

This method is responsible for deleting a Role¹ from the security repository.
PLEASE ADVISE THAT ALL ASSOCIATIONS WITH USERS WILL BE DELETED.

Parameters

  • Role role - The role being deleted.

Returns

  • void.

Dependencies

Test Suite:

  1. Test successful deletion. (This test must verify that all user associations have been removed as well)
  2. Test deleting a role that does not exist (invalid roleId), resulting in an expected fault (RoleNotFoundFault).
  3. Test deleting a null role, resulting in an expected fault (RoleRequiredFault).

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

Last edited Jun 20, 2007 at 3:21 AM by Heynemann, version 10

Comments

No comments yet.