using System.Collections.Generic; using System.Linq; using Umbraco.Core.Models.Membership; namespace Umbraco.Core.Services { /// /// Defines the UserService, which is an easy access to operations involving and eventually Users. /// public interface IUserService : IMembershipUserService { /// /// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method /// /// /// This method exists so that Umbraco developers can use one entry point to create/update users if they choose to. /// /// The user to save the password for /// The password to save void SavePassword(IUser user, string password); /// /// Deletes or disables a User /// /// to delete /// True to permanently delete the user, False to disable the user void Delete(IUser user, bool deletePermanently); /// /// Gets an IProfile by User Id. /// /// Id of the User to retrieve /// IProfile GetProfileById(int id); /// /// Gets a profile by username /// /// Username /// IProfile GetProfileByUserName(string username); /// /// Gets a user by Id /// /// Id of the user to retrieve /// IUser GetUserById(int id); /// /// Removes a specific section from all users /// /// This is useful when an entire section is removed from config /// Alias of the section to remove void DeleteSectionFromAllUsers(string sectionAlias); /// /// Add a specific section to all users or those specified as parameters /// /// This is useful when a new section is created to allow specific users accessing it /// Alias of the section to add /// Specifiying nothing will add the section to all user void AddSectionToAllUsers(string sectionAlias, params int[] userIds); /// /// Get permissions set for a user and optional node ids /// /// If no permissions are found for a particular entity then the user's default permissions will be applied /// User to retrieve permissions for /// Specifiying nothing will return all user permissions for all nodes /// An enumerable list of IEnumerable GetPermissions(IUser user, params int[] nodeIds); /// /// Replaces the same permission set for a single user to any number of entities /// /// If no 'entityIds' are specified all permissions will be removed for the specified user. /// Id of the user /// Permissions as enumerable list of /// Specify the nodes to replace permissions for. If nothing is specified all permissions are removed. void ReplaceUserPermissions(int userId, IEnumerable permissions, params int[] entityIds); #region User types /// /// Gets all UserTypes or thosed specified as parameters /// /// Optional Ids of UserTypes to retrieve /// An enumerable list of IEnumerable GetAllUserTypes(params int[] ids); /// /// Gets a UserType by its Alias /// /// Alias of the UserType to retrieve /// IUserType GetUserTypeByAlias(string alias); /// /// Gets a UserType by its Id /// /// Id of the UserType to retrieve /// IUserType GetUserTypeById(int id); /// /// Gets a UserType by its Name /// /// Name of the UserType to retrieve /// IUserType GetUserTypeByName(string name); /// /// Saves a UserType /// /// UserType to save /// Optional parameter to raise events. /// Default is True otherwise set to False to not raise events void SaveUserType(IUserType userType, bool raiseEvents = true); /// /// Deletes a UserType /// /// UserType to delete void DeleteUserType(IUserType userType); #endregion } }