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

Activities of "maharatha"

I am using EFCore and My SQL

public class Po_approval_assignment : Entity , IMayHaveTenant
    {
		

		[StringLength(Po_approval_assignmentConsts.Maxcreated_byLength, MinimumLength = Po_approval_assignmentConsts.Mincreated_byLength)]
		public virtual string created_by { get; set; }
		
		public virtual DateTime? created_date { get; set; }
		
		public virtual DateTime? last_modified_date { get; set; }
		
		[StringLength(Po_approval_assignmentConsts.Maxmodified_byLength, MinimumLength = Po_approval_assignmentConsts.Minmodified_byLength)]
		public virtual string modified_by { get; set; }
		
		[ForeignKey("po_Approval_Rule")]
		public virtual long po_approval_rule_id { get; set; }

		public Po_approval_rule po_Approval_Rule { get; set; }

		[ForeignKey("po_Reviewer")]
		public virtual long po_reviewer_id { get; set; }

		public Po_reviewer po_Reviewer { get; set; }
		
		public virtual int? version { get; set; }

        [Column("tenant_id")] public int? TenantId { get; set; }
	}

I am trying to create a composite primary key using po_approval_rule_id and po_reviewer_id

I have a table which has two foreign keys. So when I add Foreign Keys it adds two indexes in the table.

Now when I try to create an Unique Index using the two foreignkeys, it is trying to drop the indexes created by adding a column as foreign key.

On doing so the Migration doesn't run as it is unable to drop an index created by adding teh foreign key.

Cannot drop index 'IX_xyz_approval_rule_xyz_id': needed in a foreign key constraint

Thank You it worked.

When I am tryinhg to add an user in a tenant then I am trying to search this user in host using the email address or user name and if I get a hit I would like to link these two users automatically while creating the user in Tenant

Can you please guide where should I make this change in CreateUserAsync ?

You can close this. I wasn;t using gulp so it wasn't minifying

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <remove fileExtension=".json" />
            <mimeMap fileExtension=".json" mimeType="application/json" />
            <mimeMap fileExtension="woff" mimeType="application/font-woff" />
            <mimeMap fileExtension="woff2" mimeType="application/font-woff" />
            <remove fileExtension=".md" />
            <mimeMap fileExtension=".md" mimeType="text/markdown" />
            <mimeMap fileExtension=".rtl" mimeType="text/css" />
        </staticContent>
        <!-- IIS URL Rewrite  -->
        <rewrite>
            <rules>
                <rule name="Force Https" enabled="true" stopProcessing="false">
                    <conditions>
                        <add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
                        <add input="{REMOTE_HOST}" pattern="localhost" negate="true" />
                        <add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" />
                        <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="true" redirectType="Permanent" />
                </rule>
                <rule name="Angular Routes" stopProcessing="false">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/" />
                </rule>
            </rules>
            <outboundRules rewriteBeforeCache="true">
                <rule name="Remove Server header">
                    <match serverVariable="RESPONSE_Server" pattern=".+" />
                    <action type="Rewrite" value="" />
                </rule>
                <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
                    <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="on" ignoreCase="true" />
                    </conditions>
                    <action type="Rewrite" value="max-age=31536000" />
                </rule>
            </outboundRules>
        </rewrite>
        <httpProtocol>
            <customHeaders>
                <remove name="xxxx-Powered-By-xxx-yyyy" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

Version is 8.0

Question

I deployed the latest angular UI to one of my website and got this issue :

Resource interpreted as Stylesheet but transferred with MIME type text/html: "<URL>".

I have hosted it in IIS.

I deployed an older version of abp for some other porject and to the same IIS and Website and it works fine.

Then I started digging further and found some of the min.css are not getting generated when I build the angular code.

I would like to use an External authetication Provider for Host.. The idea is to allow other users to register to my Host in a similar way they can do for the Tenant. My choice of SSO would be Okta.

Later on I will be adding them to different tenants and provide permissions accordingly.

Is this possible?

Answer

This is the approach i am taking :

var userOuClaim = PrincipalAccessor.Principal?.Claims.FirstOrDefault(c => c.Type == "Application_OrganizationUnitId");

            if (AbpSession.UserId.HasValue && AbpSession.TenantId.HasValue)
            {
                var currentUserOrgId =
                    _cacheManager.GetCache(PSLConsts.UserOrganizationCache)
                        .GetOrDefault(AbpSession.UserId.Value.ToString() + AbpSession.TenantId.Value);
                if (currentUserOrgId != null)
                {
                    return Convert.ToInt32(currentUserOrgId);
                }

                if (string.IsNullOrEmpty(userOuClaim?.Value)) return null;
                _cacheManager.GetCache(PSLConsts.UserOrganizationCache).Set(AbpSession.UserId.Value.ToString(), userOuClaim.Value);
                return Convert.ToInt32(userOuClaim.Value);

            }

            if (AbpSession.UserId.HasValue && !AbpSession.TenantId.HasValue)
            {

                var currentUserOrgId =
                    _cacheManager.GetCache(PSLConsts.UserOrganizationCache)
                        .GetOrDefault(AbpSession.UserId.Value.ToString());

                if (currentUserOrgId != null)
                {
                    return Convert.ToInt32(currentUserOrgId);
                }

                if (string.IsNullOrEmpty(userOuClaim?.Value)) return null;
                _cacheManager.GetCache(PSLConsts.UserOrganizationCache).Set(AbpSession.UserId.Value.ToString(), userOuClaim.Value);
                return Convert.ToInt32(userOuClaim.Value);


            }

I am somehow not convinced with the elegence of the solution. Is there a better way. The idea is to set the Orgid when the user changes the Org or fall back to Default orgID. This is applicable for Host and Tenant

Question

I am using the below atricle to implement Organization filter :

https://aspnetboilerplate.com/Pages/Documents/Articles\How-To\add-custom-data-filter-ef-core

Everything works fine, but I would like to know how to update the user's claim.

Showing 71 to 80 of 326 entries