Skip to content

Commit

Permalink
Merge pull request #1315 from ucdavis/JCS/Pronouns
Browse files Browse the repository at this point in the history
Pronoun Support
  • Loading branch information
jSylvestre authored Sep 22, 2023
2 parents 8235045 + f6b2e97 commit a12c4e5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
9 changes: 6 additions & 3 deletions Keas.Core/Domain/User.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

Expand Down Expand Up @@ -34,9 +34,12 @@ public string Name {
[Required]
[StringLength(256)]
[EmailAddress]
public string Email { get; set; }
public string Email { get; set; }

[StringLength(50)]
public string Pronouns { get; set; }

public List<Person> People { get; set; }
public List<TeamPermission> TeamPermissions { get; set; }
}
}
}
8 changes: 4 additions & 4 deletions Keas.Core/Services/IUpdateFromIamService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public async Task<int> UpdateUsersFromLastModifiedDateInIam(DateTime modifiedAft
//Possible to get null data back for a user. Probably because they are going away
if (ietData != null && !string.IsNullOrWhiteSpace(ietData.DFirstName) && !string.IsNullOrWhiteSpace(ietData.DLastName))
{
if (user.FirstName != ietData.DFirstName || user.LastName != ietData.DLastName)
if (user.FirstName != ietData.DFirstName || user.LastName != ietData.DLastName || user.Pronouns != ietData.DPronouns)
{
count++;
batchCount++;
user.FirstName = ietData.DFirstName;
user.LastName = ietData.DLastName;
//user.pronouns = ietData.DPronouns; //if we add pronouns
user.Pronouns = ietData.DPronouns;
foreach (var person in user.People)
{
person.FirstName = ietData.DFirstName;
Expand Down Expand Up @@ -126,13 +126,13 @@ public async Task<int> UpdateAllUsersFromIam()
continue;
}

if (user.FirstName != ietData.DFirstName || user.LastName != ietData.DLastName)
if (user.FirstName != ietData.DFirstName || user.LastName != ietData.DLastName || user.Pronouns != ietData.DPronouns)
{
count++;
batchCount++;
user.FirstName = ietData.DFirstName;
user.LastName = ietData.DLastName;
//user.pronouns = ietData.DPronouns; //if we add pronouns
user.Pronouns = ietData.DPronouns;
foreach (var person in user.People)
{
person.FirstName = ietData.DFirstName;
Expand Down
3 changes: 2 additions & 1 deletion Keas.Mvc/Services/IdentityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ private User CreateUser(string email, KerberosResult ucdKerbPerson, string iamId
LastName = ucdKerbPerson.LastName,
Id = ucdKerbPerson.UserId,
Email = email,
Iam = iamId
Iam = iamId,
Pronouns = ucdKerbPerson.DPronouns
};
return user;
}
Expand Down
3 changes: 2 additions & 1 deletion Keas.Sql/dbo/Tables/Users.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CREATE TABLE [dbo].[Users] (
CREATE TABLE [dbo].[Users] (
[Id] NVARCHAR (450) NOT NULL,
[Iam] NVARCHAR (450) NULL,
[Email] NVARCHAR (256) NOT NULL,
[FirstName] NVARCHAR (50) NOT NULL,
[LastName] NVARCHAR (50) NOT NULL,
[Pronouns] NVARCHAR(50) NULL,
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ([Id] ASC)
);

Expand Down
6 changes: 5 additions & 1 deletion Test/TestsDatabase/UserTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -96,6 +96,10 @@ public void TestDatabaseFieldAttributes()
"[System.ComponentModel.DataAnnotations.StringLengthAttribute((Int32)256)]"
}));
expectedFields.Add(new NameAndType("People", "System.Collections.Generic.List`1[Keas.Core.Domain.Person]", new List<string>()));
expectedFields.Add(new NameAndType("Pronouns", "System.String", new List<string>
{
"[System.ComponentModel.DataAnnotations.StringLengthAttribute((Int32)50)]"
}));
expectedFields.Add(new NameAndType("TeamPermissions", "System.Collections.Generic.List`1[Keas.Core.Domain.TeamPermission]", new List<string>()));


Expand Down

0 comments on commit a12c4e5

Please sign in to comment.