Base solution for your next web application

Activities of "amasanad"

Hello i followed this tutrial and token is now sent on header from angualr to backend https://www.c-sharpcorner.com/article/preventing-csrf-attacks-using-asp-net-core-javascript-and-angular/ the issue now i'm gettgin exception

INFO 2023-04-03 13:02:15,539 [13 ] idateAntiforgeryTokenAuthorizationFilter - Antiforgery token validation failed. The required antiforgery cookie "XSRF-TOKEN" is not present. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie "XSRF-TOKEN" is not present. at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext) at Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.ValidateAntiforgeryTokenAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)

please help, if you can include refrence for soltuion

how to implemetn CSRF token on aspnet zero with angualr front end on all pages post login

Hi

i've try to do Synchronizer class for an entity when trying to add new enitty from tenant it goes through infinite loop of insertiaons, what is the issue ?

and i've another question how to handel primary keys on tenant for this case tenatn A can add new plan and with PK id = 1 tenatn B can add new plan and with PK id = 1 as they are on diffrenet databases, shall i add refrence to the PK like UserId on UserAccount ?

/// <summary>
    /// Synchronizes a user's information to user account.
    /// </summary>
    public class InsurancePlanSynchronizer :
        IEventHandler<EntityCreatedEventData<InsurancePlan>>,
        //IEventHandler<EntityDeletedEventData<InsurancePlan>>,
        //IEventHandler<EntityUpdatedEventData<InsurancePlan>>,
        ITransientDependency
    {
        private readonly IRepository<InsurancePlan, int> _planRepository;
        private readonly IUnitOfWorkManager _unitOfWorkManager;

        /// <summary>
        /// Constructor
        /// </summary>
        public InsurancePlanSynchronizer(
            IRepository<InsurancePlan, int> planRepo,
            IUnitOfWorkManager unitOfWorkManager)
        {
            _planRepository = planRepo;
            _unitOfWorkManager = unitOfWorkManager;
        }

        /// <summary>
        /// Handles creation event of user
        /// </summary>
        public virtual void HandleEvent(EntityCreatedEventData<InsurancePlan> eventData)
        {
            _unitOfWorkManager.WithUnitOfWork(() =>
            {
                using (_unitOfWorkManager.Current.SetTenantId(null))
                {
                        _planRepository.Insert(new InsurancePlan
                        {
                            TenantId = eventData.Entity.TenantId,
                            NameAr = eventData.Entity.NameAr,
                        });
                     
                }
            });
        }
    }

PlanAppService

        [AbpAuthorize(AppPermissions.Pages_InsurancePlans_Create)]
        protected virtual async Task Create(CreateOrEditInsurancePlanDto input)
        {
            var insurancePlan = ObjectMapper.Map<InsurancePlan>(input);

            if (AbpSession.TenantId != null)
            {
                insurancePlan.TenantId = (int?)AbpSession.TenantId;
            }

            await _insurancePlanRepository.InsertAsync(insurancePlan);
            await CurrentUnitOfWork.SaveChangesAsync(); 

        }

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? v11.3.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hello Dear,

we are developing new portal with multitenancy enabled each tenant would be on a separate database as business requirement our concern now that we can't find a way to display all realted tenant’s entities data from the host dashboard

For Example If we have an Entity "Client" that is available on Host and Tenants with ImayHaveTenant interface is there a way to display all client’s information with different tenants on the host dashboard ?

I’m aware that there is impersonate feature where I can login by tenant username and see the client’s data for that tenant, but we asking if we able to manage this or display all records from host screens ?

I have 150 tenant and i need to update their roles and permissions from Host Admin. How i can do this ? It's difficult to impersonate the 150 tenant.

Let's explain in more details.

Consider you have a tenant for telecommunication companies like Vodafone and Vodafone needs to manage their branches so they will create Organization unit for Istanbul, Ankara,...etc.

So, I need to create a Unit Admin for each unit he will be able to manage the unit users and add a user in this unit only.

PS D:\PCO Project\PCO\PCO\angular> yarn yarn install v1.19.1 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... success Already up-to-date. Done in 0.73s. PS D:\PCO Project\PCO\PCO\angular> npm run hmr

[email protected] hmr D:\PCO Project\PCO\PCO\angular gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr

[00:23:58] Using gulpfile ~~***************\gulpfile.js~~ [00:23:58] Starting 'buildDev'... Dynamic bundles are being created. [00:24:10] Finished 'buildDev' after 12 s WARNING: This is a simple server for use in testing or debugging Angular applications locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or computer. Using a different host than the one passed to the "--host" flag might result in websocket connection issues. You might need to use "--disableHostCheck" if that's the case. NOTICE: Hot Module Replacement (HMR) is enabled for the dev server. The project will still live reload when HMR is enabled, but to take advantage of HMR additional application code is required' (not included in an Angular CLI project by default).' See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack. To disable this warning use "hmrWarning: false" under "serve" options in "angular.json". 10% building 4/4 modules 0 activei 「wds」: Project is running at http://0.0.0.0:4200/webpack-dev-server/ i 「wds」: webpack output is served from / i 「wds」: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 2.15 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 149 kB [initial] [rendered] chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 531 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 31.2 kB [entry] [rendered] chunk {scripts} scripts.js, scripts.js.map (scripts) 1.54 MB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 2.03 MB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 342 kB [initial] [rendered] Date: 2019-11-26T21:24:26.940Z - Hash: 6e3d08b822b98511cde2 - Time: 11195ms

ERROR in app/main/registerations/serviceProviderOrgs/create-or-edit-serviceProviderOrg-modal.component.ts:4:10 - error TS2305: Module '"*************/angular/src/shared/service-proxies/service-proxies"' has no exported member 'ServiceProviderOrgsServiceProxy'.

4 import { ServiceProviderOrgsServiceProxy, CreateOrEditServiceProviderOrgDto } from '@shared/service-proxies/service-proxies'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ app/main/registerations/serviceProviderOrgs/create-or-edit-serviceProviderOrg-modal.component.ts:4:43 - error TS2305: Module '"*****************/angular/src/shared/service-proxies/service-proxies"' has no exported member 'CreateOrEditServiceProviderOrgDto'.

4 import { ServiceProviderOrgsServiceProxy, CreateOrEditServiceProviderOrgDto } from '@shared/service-proxies/service-proxies'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ app/main/registerations/serviceProviderOrgs/serviceProviderOrgs.component.ts:3:10 - error TS2305: Module '"****************/angular/src/shared/service-proxies/service-proxies"' has no exported member 'ServiceProviderOrgsServiceProxy'.

3 import { ServiceProviderOrgsServiceProxy, ServiceProviderOrgDto } from '@shared/service-proxies/service-proxies'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ app/main/registerations/serviceProviderOrgs/serviceProviderOrgs.component.ts:3:43 - error TS2305: Module '"******************/angular/src/shared/service-proxies/service-proxies"' has no exported member 'ServiceProviderOrgDto'.

3 import { ServiceProviderOrgsServiceProxy, ServiceProviderOrgDto } from '@shared/service-proxies/service-proxies'; ~~~~~~~~~~~~~~~~~~~~~ app/main/registerations/serviceProviderOrgs/view-serviceProviderOrg-modal.component.ts:3:10 - error TS2305: Module '"****************/angular/src/shared/service-proxies/service-proxies"' has no exported member 'GetServiceProviderOrgForViewDto'.

3 import { GetServiceProviderOrgForViewDto, ServiceProviderOrgDto } from '@shared/service-proxies/service-proxies'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ app/main/registerations/serviceProviderOrgs/view-serviceProviderOrg-modal.component.ts:3:43 - error TS2305: Module '"***************/angular/src/shared/service-proxies/service-proxies"' has no exported member 'ServiceProviderOrgDto'.

3 import { GetServiceProviderOrgForViewDto, ServiceProviderOrgDto } from '@shared/service-proxies/service-proxies'; ~~~~~~~~~~~~~~~~~~~~~ shared/service-proxies/service-proxy.module.ts:8:27 - error TS2339: Property 'ServiceProviderOrgsServiceProxy' does not exist on type 'typeof import("**************/angular/src/shared/service-proxies/service-proxies")'.

8 ApiServiceProxies.ServiceProviderOrgsServiceProxy, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ ** i 「wdm」: Failed to compile.

Same here !

I have many units and i need to create admin foreach organization unit so** this admin will have access only and manage this organiztion unit .** I tried to create admin role and assign permissions but still the organization unit admin can see the other units.

Any suggestion ?

Solved

Showing 11 to 20 of 25 entries