Base solution for your next web application

Activities of "mrvithan"

Question

By default, if the ajax service call timeout, it will notify with only "NULL". How do i customize the message ?

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.

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.

Beside SQL command timeout, do i need to config ajax call timeout also ? i have a long query which might take 3 - 5 mins to finish.

Please suggest.

I have try several method but not seem to work. Please help.

Ok i found the error. The email is duplicated...!!! But it should throw an exception..

I try to create a new user with no Tenant in an AppService using this code :

//Create user
        var user = new User
        {
            Name            = input.Name.Trim(),
            Surname         = input.Name.Trim(),
            EmailAddress    = input.Email.Trim(),
            IsActive        = true,
            TenantId        = 1
        };


        user.UserName   = input.Code;
        user.Password   = new PasswordHasher().HashPassword(input.Password);
        user.Roles      = new List&lt;UserRole&gt;();
        foreach (var agentRole in _roleManager.Roles.Where(r => r.Name == StaticRoleNames.Host.Agent).ToList())
        {
            user.Roles.Add(new UserRole { RoleId = agentRole.Id });
        }

        _userManager.Create(user);

I also setup a new role called 'Agent' with Tenant = 1. There is no error but the user has not been created.

Any suggestion ?

Yes, i did.

It happen to all controller i try to load. But now i remove the DLL and use different SDK (html2pdf) and i remove the additional code and everything run normal again.

After i add

AbpBootstrapper.IocManager.RegisterIfNot<IAssemblyFinder, CurrentDomainAssemblyFinder>();

in Global.ascx. Seem that i get this error every time i restart my server on all my controller.

No parameterless constructor defined for this object.

I have to re-compile whole solution again and it run again.

Any suggestion ?

Done !! ... thx a lot u save my life.

Showing 11 to 20 of 33 entries