Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IUserService

    Defines the UserService, which is an easy access to operations involving IProfile and eventually Users.

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IUserService : IMembershipUserService, IMembershipMemberService<IUser>, IService

    Methods

    View Source

    AssignUserGroupPermission(Int32, Char, Int32[])

    Assigns the same permission set for a single user group to any number of entities

    Declaration
    void AssignUserGroupPermission(int groupId, char permission, params int[] entityIds)
    Parameters
    Type Name Description
    System.Int32 groupId

    Id of the group

    System.Char permission
    System.Int32[] entityIds

    Specify the nodes to replace permissions for

    View Source

    ClearLoginSession(Guid)

    Removes the session's validity

    Declaration
    void ClearLoginSession(Guid sessionId)
    Parameters
    Type Name Description
    Guid sessionId
    View Source

    ClearLoginSessions(Int32)

    Removes all valid sessions for the user

    Declaration
    int ClearLoginSessions(int userId)
    Parameters
    Type Name Description
    System.Int32 userId
    Returns
    Type Description
    System.Int32
    View Source

    CreateLoginSession(Int32, String)

    Creates a database entry for starting a new login session for a user

    Declaration
    Guid CreateLoginSession(int userId, string requestingIpAddress)
    Parameters
    Type Name Description
    System.Int32 userId
    System.String requestingIpAddress
    Returns
    Type Description
    Guid
    View Source

    Delete(IUser, Boolean)

    Deletes or disables a User

    Declaration
    void Delete(IUser user, bool deletePermanently)
    Parameters
    Type Name Description
    IUser user

    IUser to delete

    System.Boolean deletePermanently

    True to permanently delete the user, False to disable the user

    View Source

    DeleteSectionFromAllUserGroups(String)

    Removes a specific section from all user groups

    Declaration
    void DeleteSectionFromAllUserGroups(string sectionAlias)
    Parameters
    Type Name Description
    System.String sectionAlias

    Alias of the section to remove

    Remarks

    This is useful when an entire section is removed from config

    View Source

    DeleteUserGroup(IUserGroup)

    Deletes a UserGroup

    Declaration
    void DeleteUserGroup(IUserGroup userGroup)
    Parameters
    Type Name Description
    IUserGroup userGroup

    UserGroup to delete

    View Source

    GetAll(Int64, Int32, out Int64, String, Direction, UserState[], String[], String)

    Get paged users

    Declaration
    IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState[] userState = null, string[] userGroups = null, string filter = null)
    Parameters
    Type Name Description
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalRecords
    System.String orderBy
    Direction orderDirection
    UserState[] userState
    System.String[] userGroups

    A filter to only include user that belong to these user groups

    System.String filter
    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetAll(Int64, Int32, out Int64, String, Direction, UserState[], String[], String[], IQuery<IUser>)

    Get paged users

    Declaration
    IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState[] userState = null, string[] includeUserGroups = null, string[] excludeUserGroups = null, IQuery<IUser> filter = null)
    Parameters
    Type Name Description
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalRecords
    System.String orderBy
    Direction orderDirection
    UserState[] userState
    System.String[] includeUserGroups

    A filter to only include user that belong to these user groups

    System.String[] excludeUserGroups

    A filter to only include users that do not belong to these user groups

    IQuery<IUser> filter
    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetAllInGroup(Nullable<Int32>)

    Gets a list of IUser objects associated with a given group

    Declaration
    IEnumerable<IUser> GetAllInGroup(int? groupId)
    Parameters
    Type Name Description
    System.Nullable<System.Int32> groupId

    Id of group

    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetAllNotInGroup(Int32)

    Gets a list of IUser objects not associated with a given group

    Declaration
    IEnumerable<IUser> GetAllNotInGroup(int groupId)
    Parameters
    Type Name Description
    System.Int32 groupId

    Id of group

    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetAllUserGroups(Int32[])

    Gets all UserGroups or those specified as parameters

    Declaration
    IEnumerable<IUserGroup> GetAllUserGroups(params int[] ids)
    Parameters
    Type Name Description
    System.Int32[] ids

    Optional Ids of UserGroups to retrieve

    Returns
    Type Description
    IEnumerable<IUserGroup>

    An enumerable list of IUserGroup

    View Source

    GetNextUsers(Int32, Int32)

    Declaration
    IEnumerable<IUser> GetNextUsers(int id, int count)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int32 count
    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetPermissions(IUser, Int32[])

    Get explicitly assigned permissions for a user and optional node ids

    Declaration
    EntityPermissionCollection GetPermissions(IUser user, params int[] nodeIds)
    Parameters
    Type Name Description
    IUser user

    User to retrieve permissions for

    System.Int32[] nodeIds

    Specifying nothing will return all user permissions for all nodes that have explicit permissions defined

    Returns
    Type Description
    EntityPermissionCollection

    An enumerable list of EntityPermission

    Remarks

    If no permissions are found for a particular entity then the user's default permissions will be applied

    View Source

    GetPermissions(IUserGroup[], Boolean, Int32[])

    Get explicitly assigned permissions for groups and optional node Ids

    Declaration
    EntityPermissionCollection GetPermissions(IUserGroup[] groups, bool fallbackToDefaultPermissions, params int[] nodeIds)
    Parameters
    Type Name Description
    IUserGroup[] groups
    System.Boolean fallbackToDefaultPermissions

    Flag indicating if we want to include the default group permissions for each result if there are not explicit permissions set

    System.Int32[] nodeIds

    Specifying nothing will return all permissions for all nodes

    Returns
    Type Description
    EntityPermissionCollection

    An enumerable list of EntityPermission

    View Source

    GetPermissionsForPath(IUser, String)

    Gets the implicit/inherited permissions for the user for the given path

    Declaration
    EntityPermissionSet GetPermissionsForPath(IUser user, string path)
    Parameters
    Type Name Description
    IUser user

    User to check permissions for

    System.String path

    Path to check permissions for

    Returns
    Type Description
    EntityPermissionSet
    View Source

    GetPermissionsForPath(IUserGroup[], String, Boolean)

    Gets the permissions for the provided groups and path

    Declaration
    EntityPermissionSet GetPermissionsForPath(IUserGroup[] groups, string path, bool fallbackToDefaultPermissions = false)
    Parameters
    Type Name Description
    IUserGroup[] groups
    System.String path

    Path to check permissions for

    System.Boolean fallbackToDefaultPermissions

    Flag indicating if we want to include the default group permissions for each result if there are not explicit permissions set

    Returns
    Type Description
    EntityPermissionSet
    View Source

    GetProfileById(Int32)

    Gets an IProfile by User Id.

    Declaration
    IProfile GetProfileById(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the User to retrieve

    Returns
    Type Description
    IProfile IProfile
    View Source

    GetProfileByUserName(String)

    Gets a profile by username

    Declaration
    IProfile GetProfileByUserName(string username)
    Parameters
    Type Name Description
    System.String username

    Username

    Returns
    Type Description
    IProfile IProfile
    View Source

    GetUserById(Int32)

    Gets a user by Id

    Declaration
    IUser GetUserById(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the user to retrieve

    Returns
    Type Description
    IUser IUser
    View Source

    GetUserGroupByAlias(String)

    Gets a UserGroup by its Alias

    Declaration
    IUserGroup GetUserGroupByAlias(string name)
    Parameters
    Type Name Description
    System.String name

    Name of the UserGroup to retrieve

    Returns
    Type Description
    IUserGroup IUserGroup
    View Source

    GetUserGroupById(Int32)

    Gets a UserGroup by its Id

    Declaration
    IUserGroup GetUserGroupById(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the UserGroup to retrieve

    Returns
    Type Description
    IUserGroup IUserGroup
    View Source

    GetUserGroupsByAlias(String[])

    Gets a UserGroup by its Alias

    Declaration
    IEnumerable<IUserGroup> GetUserGroupsByAlias(params string[] alias)
    Parameters
    Type Name Description
    System.String[] alias

    Alias of the UserGroup to retrieve

    Returns
    Type Description
    IEnumerable<IUserGroup> IUserGroup
    View Source

    GetUsersById(Int32[])

    Gets a users by Id

    Declaration
    IEnumerable<IUser> GetUsersById(params int[] ids)
    Parameters
    Type Name Description
    System.Int32[] ids

    Ids of the users to retrieve

    Returns
    Type Description
    IEnumerable<IUser> IUser
    View Source

    GetUserStates()

    This is basically facets of UserStates key = state, value = count

    Declaration
    IDictionary<UserState, int> GetUserStates()
    Returns
    Type Description
    IDictionary<UserState, System.Int32>
    View Source

    ReplaceUserGroupPermissions(Int32, Nullable<IEnumerable<Char>>, Int32[])

    Replaces the same permission set for a single group to any number of entities

    Declaration
    void ReplaceUserGroupPermissions(int groupId, IEnumerable<char>? permissions, params int[] entityIds)
    Parameters
    Type Name Description
    System.Int32 groupId

    Id of the group

    System.Nullable<IEnumerable<System.Char>> permissions

    Permissions as enumerable list of System.Char, if no permissions are specified then all permissions for this node are removed for this group

    System.Int32[] entityIds

    Specify the nodes to replace permissions for. If nothing is specified all permissions are removed.

    Remarks

    If no 'entityIds' are specified all permissions will be removed for the specified group.

    View Source

    Save(IUserGroup, Int32[])

    Saves a UserGroup

    Declaration
    void Save(IUserGroup userGroup, int[] userIds = null)
    Parameters
    Type Name Description
    IUserGroup userGroup

    UserGroup to save

    System.Int32[] userIds

    If null than no changes are made to the users who are assigned to this group, however if a value is passed in than all users will be removed from this group and only these users will be added

    View Source

    ValidateLoginSession(Int32, Guid)

    Validates that a user login session is valid/current and hasn't been closed

    Declaration
    bool ValidateLoginSession(int userId, Guid sessionId)
    Parameters
    Type Name Description
    System.Int32 userId
    Guid sessionId
    Returns
    Type Description
    System.Boolean
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • AssignUserGroupPermission(Int32, Char, Int32[])
      • ClearLoginSession(Guid)
      • ClearLoginSessions(Int32)
      • CreateLoginSession(Int32, String)
      • Delete(IUser, Boolean)
      • DeleteSectionFromAllUserGroups(String)
      • DeleteUserGroup(IUserGroup)
      • GetAll(Int64, Int32, out Int64, String, Direction, UserState[], String[], String)
      • GetAll(Int64, Int32, out Int64, String, Direction, UserState[], String[], String[], IQuery<IUser>)
      • GetAllInGroup(Nullable<Int32>)
      • GetAllNotInGroup(Int32)
      • GetAllUserGroups(Int32[])
      • GetNextUsers(Int32, Int32)
      • GetPermissions(IUser, Int32[])
      • GetPermissions(IUserGroup[], Boolean, Int32[])
      • GetPermissionsForPath(IUser, String)
      • GetPermissionsForPath(IUserGroup[], String, Boolean)
      • GetProfileById(Int32)
      • GetProfileByUserName(String)
      • GetUserById(Int32)
      • GetUserGroupByAlias(String)
      • GetUserGroupById(Int32)
      • GetUserGroupsByAlias(String[])
      • GetUsersById(Int32[])
      • GetUserStates()
      • ReplaceUserGroupPermissions(Int32, Nullable<IEnumerable<Char>>, Int32[])
      • Save(IUserGroup, Int32[])
      • ValidateLoginSession(Int32, Guid)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX