Show / Hide Table of Contents

Interface IUserService

Represents the user API service.

Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IUserService
Examples
_userService = relativityFacade.Resolve<IUserService>();

Methods

| Improve this Doc View Source

AddToGroup(Int32, Int32)

Adds the User to the group.

Declaration
void AddToGroup(int userArtifactID, int groupArtifactID)
Parameters
Type Name Description
System.Int32 userArtifactID

The user ArtifactID.

System.Int32 groupArtifactID

The group ArtifactID.

Examples
int userID = 324546;
int groupID = 78943;
_userService.AddToGroup(userID, groupID);
| Improve this Doc View Source

Create(User)

Creates the specified User.

Declaration
User Create(User user)
Parameters
Type Name Description
User user

The User to create.

Returns
Type Description
User

The created User.

Examples
User user = new User
{
	FirstName = "User First Name",
	LastName = "User Last Name",
	EmailAddress = "test@email.com",
	Type = "External",
	Password = "TestPassword2345!",
	DefaultSelectedFileType = UserDefaultSelectedFileType.LongText,
}
User createdUser = _userService.Create(user);
| Improve this Doc View Source

Delete(Int32)

Deletes the User by ArtifactID.

Declaration
void Delete(int artifactID)
Parameters
Type Name Description
System.Int32 artifactID

The ArtifactID of the user.

Examples
int userID = 23236;
_userService.Delete(userID);
| Improve this Doc View Source

ExistsByEmail(String)

Determines whether the User with the specified email address exists.

Declaration
bool ExistsByEmail(string email)
Parameters
Type Name Description
System.String email

The email address of the user.

Returns
Type Description
System.Boolean

true if a user exists; otherwise, false.

Examples
string userEmail = "some_user@email.com";
bool userExists =_userService.ExistsByEmail(userEmail);
| Improve this Doc View Source

Get(Int32)

Gets the User by ArtifactID.

Declaration
User Get(int artifactID)
Parameters
Type Name Description
System.Int32 artifactID

The ArtifactID of the user.

Returns
Type Description
User

The User entity or null.

Examples
int userID = 23236;
User user =_userService.Get(userID);
| Improve this Doc View Source

GetByEmail(String)

Gets the User by the specified email address.

Declaration
User GetByEmail(string email)
Parameters
Type Name Description
System.String email

The email address of the user.

Returns
Type Description
User

The User entity or null.

Examples
string userEmail = "some_user@email.com";
User user =_userService.GetByEmail(userEmail);
| Improve this Doc View Source

GetGroups(Int32)

Gets the list of Groups as assigned to the specified User.

Declaration
IList<NamedArtifact> GetGroups(int userArtifactID)
Parameters
Type Name Description
System.Int32 userArtifactID

The user ArtifactID.

Returns
Type Description
System.Collections.Generic.IList<NamedArtifact>

The list of Groups asigned to the User.

Examples
int userArtifactID = 324546;

IList<NamedArtifact> groups = _userService.GetGroups(userArtifactID);
| Improve this Doc View Source

RemoveFromGroup(Int32, Int32)

Removes the User from the group.

Declaration
void RemoveFromGroup(int userArtifactID, int groupArtifactID)
Parameters
Type Name Description
System.Int32 userArtifactID

The user ArtifactID.

System.Int32 groupArtifactID

The group ArtifactID.

Examples
int userID = 324546;
int groupID = 78943;
_userService.RemoveFromGroup(userID, groupID);
| Improve this Doc View Source

Require(User, Boolean)

Requires the specified User. Returns existing User if the user has the properties (ArtifactID, Email) set to be able to get the user; otherwise creates a new user.

Declaration
User Require(User user, bool ensureNew = true)
Parameters
Type Name Description
User user

The User to require.

System.Boolean ensureNew

The boolean value indicating whether we going to delete the same user. By default true.

Returns
Type Description
User

The User required.

Examples

This shows how to require existing user and get it without recreating it.

User existingUser = new User
{
	FirstName = "Existing User First Name",
	LastName = "Existing User Last Name",
	EmailAddress = "existing_user@email.com",
	ArtifactID = 1
}
User requiredUser = _userService.Require(user, false);

This shows how to create a new user from given model and get it using Require method.

User userToCreate = new User
{
	FirstName = "User First Name",
	LastName = "User Last Name",
	EmailAddress = "not_existing_user@email.com",
	Type = "External",
	Password = "TestPassword2345!",
	DefaultSelectedFileType = UserDefaultSelectedFileType.LongText,
}
User createdUser = _userService.Require(user);

This shows how to recreate existing user and get it using Require method.

User existingUser = new User
{
	FirstName = "Existing User First Name",
	LastName = "Existing User Last Name",
	EmailAddress = "existing_user@email.com",
	ArtifactID = 1
}
User recreatedUser = _userService.Require(user);
| Improve this Doc View Source

Update(User)

Updates the specified User.

Declaration
void Update(User user)
Parameters
Type Name Description
User user

The User to update.

Examples
User existingUser = _userService.GetByEmail("some_existing_user@email.com");
existingUser.Password = "newPassword123*";
existingUser.ChangePasswordNextLogin = true;
existingUser.RelativityAccess = false;
_userService.Update(existingUser);
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX