Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable "unauthenticated users" role in the list. #4095

Merged
merged 4 commits into from
Oct 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
enable "unauthenticated users" role in the list.
Fix #4094
  • Loading branch information
zyhfish committed Sep 18, 2020
commit a07cfbbf4facdb833da981af41ff0c9dad4252fd
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

using DotNetNuke.Common;

namespace Dnn.PersonaBar.UI.Services
{
using System;
Expand Down Expand Up @@ -104,17 +106,27 @@ public HttpResponseMessage GetSuggestionRoles(string keyword, int roleGroupId, i
return this.Request.CreateResponse(HttpStatusCode.OK, new List<SuggestionDto>());
}

var matchedRoles = RoleController.Instance.GetRoles(this.PortalId)
.Where(r => (roleGroupId == -2 || r.RoleGroupID == roleGroupId)
&& r.RoleName.IndexOf(keyword, StringComparison.InvariantCultureIgnoreCase) > -1
&& r.Status == RoleStatus.Approved)
.Select(r => new SuggestionDto()
var portalRoles = RoleController.Instance.GetRoles(this.PortalId);


var matchedRoles = portalRoles.Where(r => (roleGroupId == -2 || r.RoleGroupID == roleGroupId)
&& r.RoleName.IndexOf(keyword, StringComparison.InvariantCultureIgnoreCase) > Null.NullInteger
zyhfish marked this conversation as resolved.
Show resolved Hide resolved
&& r.SecurityMode != SecurityMode.SocialGroup
zyhfish marked this conversation as resolved.
Show resolved Hide resolved
&& r.Status == RoleStatus.Approved).ToList();

if (roleGroupId <= Null.NullInteger
&& Globals.glbRoleUnauthUserName.IndexOf(keyword, StringComparison.InvariantCultureIgnoreCase) > Null.NullInteger)
mitchelsellers marked this conversation as resolved.
Show resolved Hide resolved
{
matchedRoles.Add(new RoleInfo { RoleID = int.Parse(Globals.glbRoleUnauthUser), RoleName = Globals.glbRoleUnauthUserName });
zyhfish marked this conversation as resolved.
Show resolved Hide resolved
bdukes marked this conversation as resolved.
Show resolved Hide resolved
}

var data = matchedRoles.OrderBy(r => r.RoleName).Select(r => new SuggestionDto()
{
Value = r.RoleID,
Label = r.RoleName,
Label = r.RoleName
});

return this.Request.CreateResponse(HttpStatusCode.OK, matchedRoles);
return this.Request.CreateResponse(HttpStatusCode.OK, data);
}
catch (Exception ex)
{
Expand Down