I am trying to create a user management module. But i am quite confuse between user role and Authorization (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Authorization">http://www.aspnetboilerplate.com/Pages/ ... horization</a>).
I can't see how to assign "Authorization" to a user, but i can see how to create a role and assign a role to user while creating a user. But i don't think it is the same one.
May need your suggestion.
Thank for your clarification. But i have a bit more question.
From my understanding now, it seems that permissions are the subset of a a role. So we create a role (role name) and assign permissions (permission name) to its, and then we assign the role to a user. If so, then i can understand this code
var adminRoleForDefaultTenant = context.Roles.FirstOrDefault(r => r.TenantId == defaultTenant.Id && r.Name == "Admin");
if (adminRoleForDefaultTenant == null)
{
adminRoleForDefaultTenant = context.Roles.Add(new Role(defaultTenant.Id, "Admin", "Admin"));
context.SaveChanges();
//Permission definitions for Admin of 'Default' tenant
context.Permissions.Add(new RolePermissionSetting { RoleId = adminRoleForDefaultTenant.Id, Name = "CanDeleteAnswers", IsGranted = true });
context.Permissions.Add(new RolePermissionSetting { RoleId = adminRoleForDefaultTenant.Id, Name = "CanDeleteQuestions", IsGranted = true });
context.SaveChanges();
}
However, I still don't understand why we have to declare this code :
public class MyAuthorizationProvider : AuthorizationProvider
{
public override void SetPermissions(IPermissionDefinitionContext context)
{
var administration = context.CreatePermission("Administration");
var userManagement = administration.CreateChildPermission("Administration.UserManagement");
userManagement.CreateChildPermission("Administration.UserManagement.CreateUser");
var roleManagement = administration.CreateChildPermission("Administration.RoleManagement");
}
}
And if so, why do i have to declare Administration.UserManagement, not only Administration.CreateUser.
Your suggestion may help a lot.
By default, if the ajax service call timeout, it will notify with only "NULL". How do i customize the message ?
hummm ... maybe a couple month ago, 'cause it is a live-production system already. Is there any code i can apply to the previous version.
I am not sure what i did wrong. But when i throw a user friendly exception; the show "Hello World" alert; not the exception message.
Please advise.
How to reference to ABp User object from Entity class ?
For example,
[ForeignKey("ApproveManagerId")]
public virtual User ApproveManager {get;set;}
[Required]
public virtual int ApproveManagerId { get; set;
I have tried this way but compile with error.
Please advise.
User class is not defined .... seems that i don't know its namespace.
Nope. I try to reference to AbpUser<TTenant, TUser>, but still no luck
Ok i can see how already. Thx.
Do you have a sample or project using notification and signalIR to share ? i have read the document but not sure where to start first.
Thx for sharing.