Skip to content
Snippets Groups Projects
Commit d702fb86 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Product/504-mergeWorkflow' into 'Sprint/2020-11'

Product/504 merge workflow

See merge request coscine/cs/database!84
parents 1ce1a95c 1cb13795
No related branches found
No related tags found
2 merge requests!84Product/504 merge workflow,!83Sprint/2020 11
......@@ -84,6 +84,7 @@
<Compile Include="ReturnObjects\ActivatedFeatureObject.cs" />
<Compile Include="Models\LogModel.cs" />
<Compile Include="ReturnObjects\DisciplineObject.cs" />
<Compile Include="ReturnObjects\ExternalAuthenticatorsObject.cs" />
<Compile Include="ReturnObjects\FeatureObject.cs" />
<Compile Include="ReturnObjects\GitlabResourceTypeObject.cs" />
<Compile Include="ReturnObjects\IReturnObject.cs" />
......
......@@ -41,6 +41,15 @@ namespace Coscine.Database.Models
disciplines = user.UserDisciplinesUserIdIds.Select((discipline) => new DisciplineObject(discipline.Discipline.Id, discipline.Discipline.Url, discipline.Discipline.DisplayNameDe, discipline.Discipline.DisplayNameEn));
}
var externalAuthenticatorModel = new ExternalAuthenticatorModel();
var externalAuthenticators = externalAuthenticatorModel.GetAllWhere(
(externalAuthenticator) =>
(from relation in externalAuthenticator.ExternalIdsResourceTypeIdIds
where relation.UserId == user.Id select relation).Any())
.Select((externalAuthenticator) =>
new ExternalAuthenticatorsObject(
externalAuthenticator.Id, externalAuthenticator.DisplayName));
if (user.Title == null && user.TitleId.HasValue)
{
TitleModel titleModel = new TitleModel();
......@@ -65,7 +74,8 @@ namespace Coscine.Database.Models
user.Organization,
user.Institute,
disciplines,
false);
false,
externalAuthenticators);
}
public int UpdateByObject(User user, UserObject userObject)
......
using System;
namespace Coscine.Database.ReturnObjects
{
[Serializable]
public class ExternalAuthenticatorsObject : IReturnObject
{
public Guid Id { get; set; }
public string DisplayName { get; set; }
public ExternalAuthenticatorsObject(Guid id, string displayName)
{
Id = id;
DisplayName = displayName;
}
}
}
\ No newline at end of file
......@@ -30,7 +30,9 @@ namespace Coscine.Database.ReturnObjects
public bool IsRegistered { get; set; }
public UserObject(Guid id, string displayName, string givenname, string surname, string emailAddress, bool hasProjectRole = false, TitleObject title = null, LanguageObject language = null, string organization = "", string institute = "", IEnumerable<DisciplineObject> disciplines = null, bool isRegistered = false)
public IEnumerable<ExternalAuthenticatorsObject> ExternalAuthenticators { get; set; }
public UserObject(Guid id, string displayName, string givenname, string surname, string emailAddress, bool hasProjectRole = false, TitleObject title = null, LanguageObject language = null, string organization = "", string institute = "", IEnumerable<DisciplineObject> disciplines = null, bool isRegistered = false, IEnumerable<ExternalAuthenticatorsObject> externalAuthenticators = null)
{
Id = id;
DisplayName = displayName;
......@@ -46,6 +48,8 @@ namespace Coscine.Database.ReturnObjects
HasProjectRole = hasProjectRole;
IsRegistered = isRegistered;
ExternalAuthenticators = externalAuthenticators;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment