using adas_core.Domain.Models.MongoModels; using MongoDB.Bson; namespace adas_core.Authentication.Interfaces; public interface IAuthorityService { /// /// Asynchronously retrieves the list of authorizations associated with the specified user. /// /// The unique identifier of the user whose authorizations are being requested. /// A task that represents the asynchronous operation, containing a list of objects for the user. public Task> GetUserAuthorities(ObjectId userId); /// /// Creates a new role with the specified name and associates it with the given user. /// /// The name of the role to create. /// The identifier of the user to associate with the new role. public void CreateNew(string roleName, ObjectId userId); /// /// Inserts a new authorization record into the data store. /// /// The authorization entity to insert. /// A task that represents the asynchronous insert operation. public Task InsertOne(Authorization authorization); /// /// Updates a single authorization record. /// /// The authorization object containing the data to be updated. public Task updateOne(Authorization authorization); /// /// Asynchronously retrieves all authorizations. /// /// A task that represents the asynchronous operation. The task result contains a list of all authorization objects. public Task> GetAllAuthorities(); /// /// Deletes all authorities associated with the user identified by the specified id. /// /// The unique identifier of the user whose authorities should be removed. /// A task that represents the asynchronous operation. The task result contains true if authorities were deleted; otherwise, false. Task DeleteAuthoritiesForUser(ObjectId id); /// /// Creates a new user authority based on the provided . /// /// The authorization data used to create the new user authority. /// A task that represents the asynchronous operation. The task result contains the created , or null if the authority could not be created. Task CreateNewUserAuthority(Authorization authorization); /// /// Asynchronously deletes a user authority identified by the provided parsed identifier. /// /// The parsed identifier of the user authority to delete. /// A task that represents the asynchronous delete operation. The task result is if the user authority was successfully deleted; otherwise, . Task DeleteUserAuthority(ObjectId userAuthorityIdParsed); /// /// Edits the user authority using the provided authorization data. /// /// The authorization object containing the user authority details to be updated. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the authorization was not found. Task EditUserAuthority(Authorization authorization); }