Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "eggersa"

Hello.

I have to introduce a second type of user. To do that I simply inherit from the User class und put all the type related properties in the specific subclass (using Table per Type Hierarchy) like so:

public abstract class User : AbpUser<Tenant, User>
{
	// ...
}

// example of a concrete user type
[Table("ApplicationUsers")]
public class ApplicationUser : User
{
	// ...
}

However, it does not seem possible using ASP .NET Zero based on Boilerplate 0.8.4 to have a specific UserManager for each user type as the Tenant class uses the abtract User class. And by the restrictions of the AbpUserManager, this does not allow me to combine ApplicationUser with the Tenant:

public abstract class AbpUserManager<TTenant, TRole, TUser> : UserManager<TUser, long>, IDomainService, ITransientDependency
        where TTenant : AbpTenant<TTenant, TUser>
        where TRole : AbpRole<TTenant, TUser>, new()
        where TUser : AbpUser<TTenant, TUser>
{
	// ...
}
// does not work
public class UserManager : AbpUserManager<Tenant, Role, ApplicationUser>
{
	// ...
}

Maybe there is a better solution to have different user types? Reimplementing the whole AbpUserManager does not seem appropriate.

I was wondering why every javascript code is wrapped in a function like this:

(function () {
   ...
}();

I have never seen this before. Maybe there is a good idea behind this to keep going with this practice?

Thank you for your answer!

It's not the first time I am asking this myself. However, since ASP.NET Boilerplate puts a lot of effort in further abstracting the database access with generic repositories I would like to ask about the reasoning behind this. Of course, the first argument that comes in everyones mind is unit testing. But lets be honest, most companies, and especially small ones don't write unit tests at all (since customers obviously won't pay for things they do not see). Is there any other point in using the repository pattern?

Since aspnetboilerplate automatically creates some of the javascript like Web API proxies, I was wondering if I can somehow inject my own javascript builder to create some javascript version of my C# enums to use on clientside?

The value is set to RemoteOnly:

<customErrors mode="RemoteOnly">
      <error statusCode="404" redirect="~/Error/E404" />
    </customErrors>

Edit:

I just retestet the application and now it works. I probably had set mode="Off" when I last tested the application. However, I am wondering what exactly is the relation between the customErrors mode and this behavior?

Suddenly, my application started to return 500 Internal Server Error if a UserFriendlyException is thrown. For example when the user tries to log in with wrong credentials. Since the the handling of this error (mapping it to a user friendly exception that is shown on the client side) happens inside the aspnetboilerplate dlls I have almost no chance to figure out why. I am now looking for some checkpoints that could cause this behavior? I am using version 0.8.4. Thank you for your help.

Edit:

The only thing I get from the output window is: Exception thrown: 'Abp.UI.UserFriendlyException' in MyApplication.Web.dll Exception thrown: 'Abp.UI.UserFriendlyException' in mscorlib.dll

Also the exception event is not fired (IEventHandler<AbpHandledExceptionData>).

Thank you for your answer. This seems helpful. However, when we bought AspNet Zero, the actual version was 0.8.4. Would you mind to post that specific piece of code from AspNet Zero 1.11?

Hi

How can I get all users with a specific permission? Since users and roles are not directly coupled I didn't figure out a proper way to do this with a linq query.

I was asking myself if it is a good practice to have a different outcome / behaviour of a service method based on permissions? For example, the GetAll method in a service might return only the objects that I have created if I a do not have a "see all"-permission. Or the update method might ignore some properties if I do not have the permission to edit all properties of a given object.

I have this notion that one has the permission to either call an action or not. Maybe I am wrong with that one?

Hi ismcagdas

Thank you for your fast reply. As is often the case, I just found out the answer myself after publicily asking :oops:. I didn't notice that the WebUrlService is used in order to create the redirect url with the token (so it pointed to the application on my local machine which of course did not know about that token and caused the null exception. I thought that is some remote debugging magic).

However, this raises the question why not simply use the Url property from the HttpRequest object instead of configuring the base url by hand?

Showing 11 to 20 of 35 entries