You should be able to change the name of your table during OnModelCreating. You can overwrite DataAnnotation of the table name . Code-First gives precedence to Fluent API > data annotations > default conventions.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<AuditLog>().ToTable("AuditLogs ");
}
Abp user permission to authorize the users. If you are using the attribute [AbpAuthorize("name of permission")] in your controller or action, Abp will authorize the user based on that. You can think of a role as a way to group a number of permissions together. For instance, an Admin role can do CRUD on all users. This can be done with [Authorize(Role="admin)"] from asp.net mvc. The problem is when you need to prevent a particular admin user from doing it all. Let's say you want John to Create, Update but not Delete.
Basically, they serve the "same purpose", but permission give you more granular control. Hope that helps
Is it possible to get the user's role name when quering for a user.
var user = UserManager.Users.Where(e => e.Id == input.Id)
.Select(a => new UserEditDto
{
Id = a.Id,
FirstName = a.Name,
LastName = a.Surname,
Email = a.EmailAddress,
UserName = a.UserName,
RoleId = a.Roles.FirstOrDefault().RoleId // i would like Role's name instead
})
.FirstOrDefault();
Thanks
I am having the same issue when using AbpApiController.
public class UsersController : AbpApiController
{
private readonly IRepository<User, long> _userRepo;
public UsersController( IRepository<User,long> userRepo)
{
_userRepo = userRepo;
}
[HttpGet]
[UnitOfWork]
public virtual dynamic GetAll()
{
return _userRepo.GetAllList();
}
}
That worked for me. Thanks
I would like to use the same static roles for tenants. As of now, I have to create the roles for each tenant every time I create a new tenant. I want to share all four roles for all my tenants. Let's say I can the permissions for the "Student" role, I would have to change it for all tenants. I want all roles for tenants to have the same permission.
public static class StaticRoleNames
{
public static class Host
{
public const string Sysadmin = "Sysadmin";
}
public static class Tenants
{
public const string Admin = "Admin";
public const string Teacher = "Teacher";
public const string Student = "Student";
public const string Parent = "Parent";
}
}
Thank you!