Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Binary file modified src/Assets/logo.ico
Binary file not shown.
Binary file modified src/Assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions src/Security/MicroRoleModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security
{
using System;
using System.ComponentModel.DataAnnotations;

/// <summary>
/// This class contains the bare minimum properties to represent a role in the interface.
/// </summary>
public class MicroRoleModel
{
/// <summary>
/// Gets or sets the role identifier.
/// </summary>
/// <value>The role identifier.</value>
public Guid RoleId { get; set; }

/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[Required]
public string Name { get; set; }
}
}
69 changes: 69 additions & 0 deletions src/Security/MicroUserModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security
{
using System;
using System.ComponentModel.DataAnnotations;

/// <summary>
/// This class contains the bare minimum properties to represent a user in the interface.
/// </summary>
public class MicroUserModel
{
/// <summary>
/// Gets or sets the unique identity of the user.
/// </summary>
public Guid UserId { get; set; }

/// <summary>
/// Gets or sets the user's e-mail address.
/// </summary>
[StringLength(100)]
public string Email { get; set; }

/// <summary>
/// Gets or sets the first name.
/// </summary>
/// <value>The first name.</value>
[StringLength(100)]
public string FirstName { get; set; }

/// <summary>
/// Gets or sets the last name.
/// </summary>
/// <value>The last name.</value>
[StringLength(100)]
public string LastName { get; set; }

/// <summary>
/// Gets the user full name.
/// </summary>
public string FullName
{
get
{
return $"{this.FirstName} {this.LastName}".Trim();
}
}

/// <summary>
/// Gets or sets the user name of the user.
/// </summary>
[StringLength(100)]
public string UserName { get; set; }
}
}
60 changes: 60 additions & 0 deletions src/Security/MinimalRoleModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

/// <summary>
/// Contains an enumerated list of role types.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum RoleTypes
{
/// <summary>
/// System Roles Cannot be Deleted.
/// </summary>
System,

/// <summary>
/// User Defined Roles.
/// </summary>
Defined
}

/// <summary>
/// This class represents a minimal representation of a security role.
/// </summary>
public class MinimalRoleModel : MicroRoleModel
{
/// <summary>
/// Gets or sets the role description.
/// </summary>
public string Description { get; set; }

/// <summary>
/// Gets or sets the type of the role.
/// </summary>
/// <value>The type of the role.</value>
public RoleTypes RoleType { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the role is a system role and cannot be deleted.
/// </summary>
public bool Deleteable { get; set; }
}
}
47 changes: 47 additions & 0 deletions src/Security/MinimalUserModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security
{
using System;

/// <summary>
/// This class represents a user that is assigned to a role. It is a stripped down version of the user and returns only essential information related to the
/// user for role associations.
/// </summary>
public class MinimalUserModel : MicroUserModel
{
/// <summary>
/// Gets or sets the user's desired language.
/// </summary>
public string Locale { get; set; }

/// <summary>
/// Gets or sets the user's time zone.
/// </summary>
public string TimeZone { get; set; }

/// <summary>
/// Gets a value indicating whether the user is locked.
/// </summary>
public bool Locked => this.LockExpirationDate.HasValue;

/// <summary>
/// Gets or sets the lock expiration date.
/// </summary>
public DateTime? LockExpirationDate { get; set; }
}
}
33 changes: 33 additions & 0 deletions src/Security/Queries/RoleQueryFilterModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security.Queries
{
using Talegen.Common.Models.Shared.Queries;

/// <summary>
/// This class defines the administration role query filter model.
/// </summary>
/// <seealso cref="Talegen.Common.Models.Shared.Queries.PaginatedQueryRequestModel" />
public class RoleQueryFilterModel : PaginatedQueryRequestModel
{
/// <summary>
/// Gets or sets the search text.
/// </summary>
/// <value>The search text.</value>
public string SearchText { get; set; }
}
}
39 changes: 39 additions & 0 deletions src/Security/Queries/UserQueryFilterModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security.Queries
{
using Talegen.Common.Models.Shared.Queries;

/// <summary>
/// This class defines the administration user query filter model.
/// </summary>
/// <seealso cref="Talegen.Common.Models.Shared.Queries.PaginatedQueryRequestModel" />
public class UserQueryFilterModel : PaginatedQueryRequestModel
{
/// <summary>
/// Gets or sets the search text.
/// </summary>
/// <value>The search text.</value>
public string SearchText { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the search filter should show only active users.
/// </summary>
/// <value><c>true</c> if only active; otherwise, <c>false</c> and return all users.</value>
public bool OnlyActive { get; set; } = true;
}
}
63 changes: 63 additions & 0 deletions src/Security/RoleModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
*
* (c) Copyright Talegen, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

namespace Talegen.Common.Models.Security
{
using System;
using System.Collections.Generic;

/// <summary>
/// This model class represents a security role within the application.
/// </summary>
public class RoleModel : MinimalRoleModel
{
/// <summary>
/// Gets or sets the record created date time.
/// </summary>
public DateTime CreatedDate { get; set; }

/// <summary>
/// Gets or sets the user model for the creating user.
/// </summary>
public MicroUserModel CreatedBy { get; set; }

/// <summary>
/// Gets or sets the record last updated date time.
/// </summary>
public DateTime? UpdatedDate { get; set; }

/// <summary>
/// Gets or sets the user model for the updating user.
/// </summary>
public MicroUserModel UpdatedBy { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the role is automatically added to users when they are synchronized via the application subscription Redis channel.
/// </summary>
public bool Default { get; set; }

/// <summary>
/// Gets or sets a list of user models assigned to this role.
/// </summary>
public List<MicroUserModel> Users { get; set; } = new List<MicroUserModel>();

/// <summary>
/// Gets or sets the claims assigned to the role.
/// </summary>
/// <value>The claims assigned to the role.</value>
public Dictionary<string, string> Claims { get; set; } = new Dictionary<string, string>();
}
}
Loading