Skip to content

Commit

Permalink
Set the PickerEntity.EntityType correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Feb 9, 2024
1 parent d2d5ea6 commit b158bb5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Yvand.LDAPCPSE/Yvand.LdapClaimsProvider/LDAPCPSE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,11 @@ protected PickerEntity CreatePickerEntityHelper(OperationContext currentContext,
SPClaim claim = CreateClaim(directoryObjectIdentifierConfig.ClaimType, permissionValue, directoryObjectIdentifierConfig.ClaimValueType);
PickerEntity entity = CreatePickerEntity();
entity.Claim = claim;
entity.EntityType = directoryObjectIdentifierConfig.DirectoryObjectType == DirectoryObjectType.User ? SPClaimEntityTypes.User : ClaimsProviderConstants.GroupClaimEntityType;
entity.EntityType = directoryObjectIdentifierConfig.SPEntityType;
if (String.IsNullOrWhiteSpace(entity.EntityType))
{
entity.EntityType = directoryObjectIdentifierConfig.DirectoryObjectType == DirectoryObjectType.User ? SPClaimEntityTypes.User : ClaimsProviderConstants.GroupClaimEntityType;
}
entity.IsResolved = true;
entity.EntityGroupName = this.Name;
entity.Description = String.Format(PickerEntityOnMouseOver, result.ClaimTypeConfigMatch.DirectoryObjectAttribute, result.DirectoryAttributeValueMatch);
Expand Down Expand Up @@ -849,22 +853,20 @@ private List<PickerEntity> CreatePickerEntityForSpecificClaimTypes(string claimV
entity.Claim = claim;
entity.IsResolved = true;
entity.EntityType = ctConfig.SPEntityType;
if (String.IsNullOrEmpty(entity.EntityType))
if (String.IsNullOrWhiteSpace(entity.EntityType))
{
entity.EntityType = ctConfig.DirectoryObjectType == DirectoryObjectType.User ? SPClaimEntityTypes.User : ClaimsProviderConstants.GroupClaimEntityType;
}
entity.EntityGroupName = this.Name;
entity.Description = String.Format(PickerEntityOnMouseOver, ctConfig.DirectoryObjectAttribute, claimValue);
entity.DisplayText = FormatPermissionDisplayText(null, ctConfig, claimValue);

if (!String.IsNullOrEmpty(ctConfig.SPEntityDataKey))
if (!String.IsNullOrWhiteSpace(ctConfig.SPEntityDataKey))
{
entity.EntityData[ctConfig.SPEntityDataKey] = entity.Claim.Value;
Logger.Log($"[{Name}] Added metadata '{ctConfig.SPEntityDataKey}' with value '{entity.EntityData[ctConfig.SPEntityDataKey]}' to new entity", TraceSeverity.VerboseEx, EventSeverity.Information, TraceCategory.Claims_Picking);
}

//ClaimsProviderEntity fakeLdapResult = new ClaimsProviderEntity(ctConfig, claimValue);
entity.DisplayText = FormatPermissionDisplayText(null, ctConfig, claimValue);

entities.Add(entity);
Logger.Log($"[{Name}] Created entity: display text: '{entity.DisplayText}', claim value: '{entity.Claim.Value}', claim type: '{entity.Claim.ClaimType}'.", TraceSeverity.VerboseEx, EventSeverity.Information, TraceCategory.Claims_Picking);
}
Expand Down

0 comments on commit b158bb5

Please sign in to comment.