Nucleus .Net Core CMS

Managers.IUserManager Interface

Namespace: Nucleus.Abstractions.Managers
Assembly: Nucleus.Abstractions.dll
Provides functions to manage database data for Models.Users.
Get an instance of this class from dependency injection by including a parameter in your class constructor.
AddRole (User user, Guid roleId)
Add the specified Models.Role to the specified Models.User.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
roleId Guid
Remarks
Changes are not saved to the database. Call the Save method to save changes.
CountSystemAdministrators ()
Count the number of System Administrator Models.Users.
CreateNew (Nucleus.Abstractions.Models.Site)
Create a new Models.User with default values.
Remarks
This function does not save the new Models.User to the database. Call Save to save the role group.
Delete (User user)
Delete the specified Models.User from the database.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
Get (Site site, Guid id)
Retrieve an existing Models.User from the database.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
id Guid
Get (Guid id)
Retrieve an existing Models.User from the database.
Parameters
Name Type
id Guid
Get (Site site, String userName)
Retrieve an existing Models.User from the database, matching by the specified userName.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
userName String
GetByEmail (Site site, String email)
Retrieve an existing Models.User from the database, matching by the specified email address.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
email String
GetSystemAdministrator (String userName)
Retrieve an existing System Administrator Models.User from the database, matching by the specified userName.
Parameters
Name Type
userName String
List (Site site)
List all Models.Users who belong to the specified Models.Site.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
List (Site site, PagingSettings pagingSettings)
List a page of Models.Users who belong to the specified Models.Site.
List (Site site, PagingSettings pagingSettings, User filterExpression)
List a page of Models.Users who belong to the specified Models.Site.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
pagingSettings Nucleus.Abstractions.Models.Paging.PagingSettings
filterExpression System.Linq.Expressions.Expression<System.Func<Nucleus.Abstractions.Models.User
ListSystemAdministrators (Nucleus.Abstractions.Models.Paging.PagingSettings)
List all System Administrator Models.Users.
ListUsersInRole (Role role)
List the Models.Users who are members of the specified Models.Role.
Parameters
Name Type
role Nucleus.Abstractions.Models.Role
ListUsersInRole (Role role, PagingSettings pagingSettings)
List the Models.Users who are members of the specified Models.Role with paging.
RemoveRole (User user, Guid roleId)
Removes the specified Models.Role to the specified Models.User.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
roleId Guid
Remarks
Changes are not saved to the database. Call the Save method to save changes.
Save (Site site, User user)
Create or update the specified Models.User.
SaveSecrets (User user)
Save user secrets.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
SaveSystemAdministrator (User user)
Create or update the specified System Administrator Models.User.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
Search (Site site, String searchTerm, PagingSettings pagingSettings)
Returns a list of Models.Users whi match the specified searchTerm.
Search (Site site, String searchTerm, PagingSettings pagingSettings, User filterExpression)
Returns a list of Models.Users whi match the specified searchTerm.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
searchTerm String
pagingSettings Nucleus.Abstractions.Models.Paging.PagingSettings
filterExpression System.Linq.Expressions.Expression<System.Func<Nucleus.Abstractions.Models.User
SetNewUserFlags (Site site, User user)
Set Models.User approved and verified flags based on site settings.
Remarks
This function is called by CreateNew, so it doesn't need to be called unless the user is being created without a call to CreateNew().
SetPassword (User user, String newPassword)
Set a new password for the specified user.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
newPassword String
Remarks
This function saves the new password to the database.
SetPasswordResetToken (User user)
Generate and set a random password reset token.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
SetVerificationToken (User user)
Generate and set a random verification token.
Parameters
Name Type
user Nucleus.Abstractions.Models.User
UnlockUser (User user)
Unlock the specified user's account
Parameters
Name Type
user Nucleus.Abstractions.Models.User
ValidatePasswordComplexity (String key, String password)
Check that the specified password is valid.
Parameters
Name Type
key String

The key for model state errors. This is generally the name of the model property being validated.

password String
Remarks
Each Models.Configuration.PasswordComplexityRule is executed, and the results are returned in a ModelStateDictionary.
VerifyPassword (User user, String password)
Verify that the user's password is correct
Parameters
Name Type
user Nucleus.Abstractions.Models.User
password String
Remarks
This function also manages failed login tracking, account suspension