Base solution for your next web application

Activities of "david"

Hi hikalkan,

Thanks for your response. As abp cache is extending memory cache, it could be nice if we can use the methods provides. I agree that is not best practice to storing disposable items in cache, however this is a gray zone :D it is a costly initialization and wanted to test whether cache or singleton performs better in long term running. In addition to the previous question, ive also tried redis cache. I noticed that if i try to clear all caches in initialize method(as redis is still running after application restart and previous cached items persist) i get an exception. I didnt had the time to test whether the exception is thrown while trying to clear the container of holding disposable objects or not. Maybe tomorrow.

Hi,

I was wondering if there is any way to store disposable items in cache?

Basically, if i could achieve functionality like this: <a class="postlink" href="http://stackoverflow.com/a/32706574/6223751">http://stackoverflow.com/a/32706574/6223751</a> for a cacheitem, it would be great.

Thanks

Hi guys,

I'm trying to implement something with swagger. Basically i have enabled swagger for my new app. For the swagger, i have created a custom filter named HideInDocs which uses regex to hide some framework default methods from swagger ui page (ie app/user, app/tenant, app/session)

Now, i need to also hide authorized methods that current has no permissions to access it. this works fine if the methods are webapi methods. Using apiDescription.GetControllerAndActionAttributes<object>(); i can get required permissions for the method and then check if a permission is granted for current user and decide whether to include it in swagger ui page or not.

The problem arises when i'm trying to do the same for dynamicApi generated methods as var test = apiDescription.GetControllerAndActionAttributes<object>(); returns nothing. Seems that attributes are not reflected for dynamically generated methods.

Is there any way to achieve the same functionality on dynamicWebapi methods?

Below is my DocFilter:

public class HideInDocsFilter : IDocumentFilter
        {
            public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
            {
                foreach (var apiDescription in apiExplorer.ApiDescriptions)
                {
                    var test = apiDescription.GetControllerAndActionAttributes<object>();
                    //remove from docs autogenerated services
                    Regex r = new Regex("AbpCache|AbpServiceProxies|app/session|app/tenant|app/user|ServiceProxies|TypeScript");
                    if (r.IsMatch(apiDescription.ID))
                    {
                        swaggerDoc.paths.Remove("/" + apiDescription.RelativePath.Split('?')[0]);
                    }
                }
            }
        }

Thanks hikalkan for your suggestion, However i cannot use cookie to determine this info. The reason is that im having two types of users. App users and normal users. Normal users have the UI to create App users. The only difference between them is an enum that defines a user as App user. App users have different set of permissions. No problem on that. Using cookie approach will work in production but will fail in swagger tests because the app user it is used with swagger bearer authentication should probably accessed the ui and generated the cookie on same domain as the swagger(might be wrong here)

The solution im using now is an app service that determines usertype enum by user id by using usermanager. However i was looking if there was some more elegant and faster already in claims, or maybe provide me some more info regarding your second proposed solution as i haven't got it.

Thanks again and keep great work.

This is what i do in my web module, you can do the same in your Application module:

public static class AutoMapperWebConfiguration { public static void Configure() { ConfigureAdministrationMapping();

    }

    private static void ConfigureAdministrationMapping()
    {
        var input = Mapper.CreateMap&lt;ServerViewModel, ServerInput&gt;();
        var AppUserToUserMap = Mapper.CreateMap&lt;UserListDto, AppUserViewModel&gt;()
            .ForMember(dest => dest.AppID,
                       opts => opts.MapFrom(src => src.UserName));
    }

}

and in initialize method of the module, i call AutoMapperWebConfiguration.Configure();

It works for me, i don't know if there is a more elegant way of achieving it

This is probably Identity question, but i would be grateful if you can help.

Basically I would like to know if a user is logged in using token (through API) or using cookies(default login form)

Thanks

Answer

I was having error too while testing db per tenant. What solved me the issue on my dev machine, was to enable TCP/IP connections to the sql express server: <a class="postlink" href="http://blog.citrix24.com/configure-sql-express-to-accept-remote-connections/">http://blog.citrix24.com/configure-sql- ... nnections/</a>

Your connection string looks ok

You may ignore the firewall part oft he tutorial if you you are working locally.

Hello,

I downloaded the latest template including module zero (EF with Multipage app). The first issue i faced is the one already posted at #1201

Then, after fixing the above

I was trying to implement external login with Google+ but i'm getting Abp.Authorization.Users.AbpLoginResultType.UnknownExternalLogin as login result.

Please note, that the first time a user clicks google, the user successfully registers. However, after registration is not getting logged in. The same result appears when a registered user is trying to get in using google+

I thought i missed something, however i downloaded the eventcloud sample project, wired up my google api credentials and tried and it was working as expected.

Then, i upgraded to 0.9.1.1 using nuget console, i applied the required changes for the project to build and run the upgraded EventCloud solution and voila, the same error appears Abp.Authorization.Users.AbpLoginResultType.UnknownExternalLogin as login result of an account already registered using google. As a result, the user instead of getting logged in in the app, it is redirected to register a new account with an error of a user with same email already registered.

Answer

That is what i was thinking of at the beginning. Just wondering if there was already something automated and missed it i.e like the way the fw is holding the tenancy permissions and settings.

Thanks for the confirmation Hikalkan

Question

Hi all,

Nice job guys.

I was wondering what is the best way to implement cache per tenancy?

For example i have an entity that implements IMustHaveTenant.

i have a property named "name" which is unique for each tenant. I would like my appService getByName method, to return this entity from cache. However, if two tenants have an entry with same "name", cache returns the object of the first accessed.

What is the best practice to implement this functionality?

Showing 1 to 10 of 12 entries