AuthenticationService  v0.2.0
Public Member Functions | List of all members
Joutsen.Authentication.RoleRepository Interface Reference

A repository that provides access to persisted roles and offers ways to create and delete them. More...

Public Member Functions

Page< RoleFind (long userId, long applicationId, int pageNumber=0, int maxResults=int.MaxValue)
 Search for a certain number of roles belonging to a user in an application. More...
 
Role GetById (long id)
 Fetches a role by its unique identifier. More...
 
long Save (String name, long userId, long applicationId, String description=null)
 Persists a new role. More...
 
bool Delete (long id)
 Deletes a persisted role. More...
 
Role Create ()
 Creates a new instance of a role. More...
 

Detailed Description

A repository that provides access to persisted roles and offers ways to create and delete them.

Since
0.1.0

Member Function Documentation

◆ Create()

Role Joutsen.Authentication.RoleRepository.Create ( )

Creates a new instance of a role.

Implemented in Joutsen.Authentication.Persistence.NHibernate.NHibernateRoleRepository.

◆ Delete()

bool Joutsen.Authentication.RoleRepository.Delete ( long  id)

Deletes a persisted role.

Parameters
idthe unique identifier of the role
Returns
true if the role was found and deleted, otherwise false

Implemented in Joutsen.Authentication.Persistence.NHibernate.NHibernateRoleRepository.

◆ Find()

Page<Role> Joutsen.Authentication.RoleRepository.Find ( long  userId,
long  applicationId,
int  pageNumber = 0,
int  maxResults = int.MaxValue 
)

Search for a certain number of roles belonging to a user in an application.

Parameters
userIdthe unique identifier of the user who has the role that is searched for
applicationIdthe unique application the role that is searched for belongs to
pageNumberidentifies the page of matching roles to return
maxResultsthe maximum number of roles to return. This also defines the page size.
Returns
the matching roles on the defined page

Implemented in Joutsen.Authentication.Persistence.NHibernate.NHibernateRoleRepository.

◆ GetById()

Role Joutsen.Authentication.RoleRepository.GetById ( long  id)

Fetches a role by its unique identifier.

◆ Save()

long Joutsen.Authentication.RoleRepository.Save ( String  name,
long  userId,
long  applicationId,
String  description = null 
)

Persists a new role.

Parameters
namethe human friendly name of the role
userIdthe unique identifier of the user who gets the role
applicationIdthe unique identifier of the application the role belongs to
descriptionan optional description of the role. If the description is omitted abd a role with the same name already exists for the application the description is copied to the new role
Returns
the unique identifier of the persisted role

Implemented in Joutsen.Authentication.Persistence.NHibernate.NHibernateRoleRepository.