Kullanıcılara UserType sütunu eklendi
This commit is contained in:
parent
3d2b38407b
commit
3a03c8e1e8
20 changed files with 321 additions and 98 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Volo.Abp.ObjectExtending;
|
using Volo.Abp.ObjectExtending;
|
||||||
|
using static Sozsoft.Platform.PlatformConsts;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.Identity.Dto;
|
namespace Sozsoft.Platform.Identity.Dto;
|
||||||
|
|
||||||
|
|
@ -20,6 +21,7 @@ public class UserInfoViewModel : ExtensibleObject
|
||||||
public bool LockoutEnabled { get; set; }
|
public bool LockoutEnabled { get; set; }
|
||||||
public DateTimeOffset? LockoutEnd { get; set; }
|
public DateTimeOffset? LockoutEnd { get; set; }
|
||||||
public DateTime? LoginEndDate { get; set; }
|
public DateTime? LoginEndDate { get; set; }
|
||||||
|
public UserType UserType { get; set; }
|
||||||
public bool IsVerified { get; set; }
|
public bool IsVerified { get; set; }
|
||||||
public List<string> userRoleNames { get; set; }
|
public List<string> userRoleNames { get; set; }
|
||||||
public AssignedRoleViewModel[] Roles { get; set; }
|
public AssignedRoleViewModel[] Roles { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using static Sozsoft.Platform.PlatformConsts;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.ListForms.DynamicApi;
|
namespace Sozsoft.Platform.ListForms.DynamicApi;
|
||||||
|
|
||||||
|
|
@ -17,5 +18,6 @@ public class CreateUpdateUserInput
|
||||||
public bool? IsActive { get; set; }
|
public bool? IsActive { get; set; }
|
||||||
public bool? LockoutEnabled { get; set; }
|
public bool? LockoutEnabled { get; set; }
|
||||||
public string[] RoleNames { get; set; }
|
public string[] RoleNames { get; set; }
|
||||||
|
public UserType UserType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using Sozsoft.Platform.Entities;
|
||||||
using Sozsoft.Platform.Extensions;
|
using Sozsoft.Platform.Extensions;
|
||||||
using Sozsoft.Platform.Identity.Dto;
|
using Sozsoft.Platform.Identity.Dto;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using OpenIddict.Abstractions;
|
using OpenIddict.Abstractions;
|
||||||
|
|
@ -287,8 +288,9 @@ public class PlatformIdentityAppService : ApplicationService
|
||||||
user.SetGraduationSchool(UserInfo.GraduationSchool);
|
user.SetGraduationSchool(UserInfo.GraduationSchool);
|
||||||
user.SetBloodType(UserInfo.BloodType);
|
user.SetBloodType(UserInfo.BloodType);
|
||||||
user.SetAvatar(UserInfo.Avatar);
|
user.SetAvatar(UserInfo.Avatar);
|
||||||
|
user.SetUserType(UserInfo.UserType);
|
||||||
|
|
||||||
await UserManager.UpdateAsync(user);
|
(await UserManager.UpdateAsync(user)).CheckErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(IdentityPermissions.Users.Update)]
|
[Authorize(IdentityPermissions.Users.Update)]
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ public static class UserInfoViewModelMappingExtensions
|
||||||
{
|
{
|
||||||
public static UserInfoViewModel MapIdentityExtraProperties(this UserInfoViewModel userInfoViewModel, IdentityUser user)
|
public static UserInfoViewModel MapIdentityExtraProperties(this UserInfoViewModel userInfoViewModel, IdentityUser user)
|
||||||
{
|
{
|
||||||
|
userInfoViewModel.UserType = user.GetUserType();
|
||||||
userInfoViewModel.IsVerified = user.GetIsVerified();
|
userInfoViewModel.IsVerified = user.GetIsVerified();
|
||||||
userInfoViewModel.LoginEndDate = user.GetLoginEndDate();
|
userInfoViewModel.LoginEndDate = user.GetLoginEndDate();
|
||||||
userInfoViewModel.Avatar = user.GetAvatar();
|
userInfoViewModel.Avatar = user.GetAvatar();
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
|
||||||
user.SetDepartmentId(ParseGuid(input.Data.DepartmentId));
|
user.SetDepartmentId(ParseGuid(input.Data.DepartmentId));
|
||||||
user.SetJobPositionId(ParseGuid(input.Data.JobPositionId));
|
user.SetJobPositionId(ParseGuid(input.Data.JobPositionId));
|
||||||
user.SetIsVerified(verify);
|
user.SetIsVerified(verify);
|
||||||
|
user.SetUserType(input.Data.UserType);
|
||||||
|
|
||||||
await SaveAvatarAsync(user, input.Data.Avatar);
|
await SaveAvatarAsync(user, input.Data.Avatar);
|
||||||
|
|
||||||
|
|
@ -199,6 +200,8 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
|
||||||
user.SetJobPositionId(ParseGuid(input.Data.JobPositionId));
|
user.SetJobPositionId(ParseGuid(input.Data.JobPositionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user.SetUserType(input.Data.UserType);
|
||||||
|
|
||||||
await SaveAvatarAsync(user, input.Data.Avatar);
|
await SaveAvatarAsync(user, input.Data.Avatar);
|
||||||
|
|
||||||
(await userManager.UpdateAsync(user)).CheckErrors();
|
(await userManager.UpdateAsync(user)).CheckErrors();
|
||||||
|
|
|
||||||
|
|
@ -2502,6 +2502,24 @@
|
||||||
"en": "Education Level",
|
"en": "Education Level",
|
||||||
"tr": "Eğitim Seviyesi"
|
"tr": "Eğitim Seviyesi"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "Abp.Account.UserType",
|
||||||
|
"en": "User Type",
|
||||||
|
"tr": "Kullanıcı Tipi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "Abp.Account.UserType.Internal",
|
||||||
|
"en": "Internal",
|
||||||
|
"tr": "İç Kullanıcı"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "Abp.Account.UserType.External",
|
||||||
|
"en": "External",
|
||||||
|
"tr": "Dış Kullanıcı"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "Abp.Account.Nationality",
|
"key": "Abp.Account.Nationality",
|
||||||
|
|
@ -17454,6 +17472,12 @@
|
||||||
"en": "URL",
|
"en": "URL",
|
||||||
"tr": "URL"
|
"tr": "URL"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "App.Listform.ListformField.UserType",
|
||||||
|
"en": "User Type",
|
||||||
|
"tr": "Kullanıcı Tipi"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "App.Listform.ListformField.UserName",
|
"key": "App.Listform.ListformField.UserName",
|
||||||
|
|
|
||||||
|
|
@ -891,6 +891,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
||||||
|
new() { FieldName = "UserType", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||||
new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }
|
new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }
|
||||||
}),
|
}),
|
||||||
WidgetsJson = JsonSerializer.Serialize(new List<WidgetEditDto>
|
WidgetsJson = JsonSerializer.Serialize(new List<WidgetEditDto>
|
||||||
|
|
@ -946,8 +947,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
#region Users Fields
|
#region Users Fields
|
||||||
await _listFormFieldRepository.InsertManyAsync(
|
await _listFormFieldRepository.InsertManyAsync(
|
||||||
[
|
[
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -964,8 +964,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -988,8 +987,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1012,8 +1010,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1036,8 +1033,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1060,8 +1056,41 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
|
||||||
{
|
new ListFormField {
|
||||||
|
ListFormCode = listForm.ListFormCode,
|
||||||
|
RoleId = null,
|
||||||
|
UserId = null,
|
||||||
|
CultureName = LanguageCodes.En,
|
||||||
|
SourceDbType = DbType.Int16,
|
||||||
|
FieldName = "UserType",
|
||||||
|
EditGroupOrderNo = 1,
|
||||||
|
EditOrderNo = 5,
|
||||||
|
EditorType2 = EditorTypes.dxSelectBox,
|
||||||
|
ColSpan = 1,
|
||||||
|
CaptionName = "App.Listform.ListformField.UserType",
|
||||||
|
Width = 0,
|
||||||
|
ListOrderNo = 5,
|
||||||
|
Visible = true,
|
||||||
|
IsActive = true,
|
||||||
|
LookupJson = JsonSerializer.Serialize(new LookupDto
|
||||||
|
{
|
||||||
|
|
||||||
|
DataSourceType = UiLookupDataSourceTypeEnum.StaticData,
|
||||||
|
DisplayExpr = "name",
|
||||||
|
ValueExpr = "key",
|
||||||
|
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||||
|
new () { Key=PlatformConsts.AbpIdentity.User.InternalUserTypeDefaultValue, Name="Internal" },
|
||||||
|
new () { Key=PlatformConsts.AbpIdentity.User.ExternalUserTypeDefaultValue, Name="External" },
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||||
|
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||||
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
|
},
|
||||||
|
|
||||||
|
new ListFormField {
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1069,12 +1098,12 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.String,
|
||||||
FieldName = "PhoneNumber",
|
FieldName = "PhoneNumber",
|
||||||
EditGroupOrderNo = 1,
|
EditGroupOrderNo = 1,
|
||||||
EditOrderNo = 5,
|
EditOrderNo = 6,
|
||||||
EditorType2 = EditorTypes.dxTextBox,
|
EditorType2 = EditorTypes.dxTextBox,
|
||||||
ColSpan = 1,
|
ColSpan = 1,
|
||||||
CaptionName = "Abp.Identity.User.UserInformation.PhoneNumber",
|
CaptionName = "Abp.Identity.User.UserInformation.PhoneNumber",
|
||||||
Width = 0,
|
Width = 0,
|
||||||
ListOrderNo = 5,
|
ListOrderNo = 6,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
|
|
||||||
|
|
@ -1085,8 +1114,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1094,7 +1122,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.String,
|
||||||
FieldName = "WorkHour",
|
FieldName = "WorkHour",
|
||||||
EditGroupOrderNo = 1,
|
EditGroupOrderNo = 1,
|
||||||
EditOrderNo = 6,
|
EditOrderNo = 7,
|
||||||
EditorType2 = EditorTypes.dxSelectBox,
|
EditorType2 = EditorTypes.dxSelectBox,
|
||||||
ColSpan = 1,
|
ColSpan = 1,
|
||||||
EditorOptions = EditorOptionValues.ShowClearButton,
|
EditorOptions = EditorOptionValues.ShowClearButton,
|
||||||
|
|
@ -1112,8 +1140,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
|
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1121,7 +1148,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
SourceDbType = DbType.Guid,
|
SourceDbType = DbType.Guid,
|
||||||
FieldName = "DepartmentId",
|
FieldName = "DepartmentId",
|
||||||
EditGroupOrderNo = 1,
|
EditGroupOrderNo = 1,
|
||||||
EditOrderNo = 7,
|
EditOrderNo = 8,
|
||||||
EditorType2 = EditorTypes.dxSelectBox,
|
EditorType2 = EditorTypes.dxSelectBox,
|
||||||
ColSpan = 1,
|
ColSpan = 1,
|
||||||
EditorOptions = EditorOptionValues.ShowClearButton,
|
EditorOptions = EditorOptionValues.ShowClearButton,
|
||||||
|
|
@ -1145,8 +1172,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
|
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1154,7 +1180,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
SourceDbType = DbType.Guid,
|
SourceDbType = DbType.Guid,
|
||||||
FieldName = "JobPositionId",
|
FieldName = "JobPositionId",
|
||||||
EditGroupOrderNo = 1,
|
EditGroupOrderNo = 1,
|
||||||
EditOrderNo = 8,
|
EditOrderNo = 9,
|
||||||
EditorType2 = EditorTypes.dxSelectBox,
|
EditorType2 = EditorTypes.dxSelectBox,
|
||||||
ColSpan = 1,
|
ColSpan = 1,
|
||||||
EditorOptions = EditorOptionValues.ShowClearButton,
|
EditorOptions = EditorOptionValues.ShowClearButton,
|
||||||
|
|
@ -1180,8 +1206,29 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
|
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
ListFormCode = listForm.ListFormCode,
|
||||||
|
RoleId = null,
|
||||||
|
UserId = null,
|
||||||
|
CultureName = LanguageCodes.En,
|
||||||
|
SourceDbType = DbType.String,
|
||||||
|
FieldName = "Password",
|
||||||
|
EditGroupOrderNo = 1,
|
||||||
|
EditOrderNo = 10,
|
||||||
|
EditorType2 = EditorTypes.dxTextBox,
|
||||||
|
ColSpan = 1,
|
||||||
|
CaptionName = "App.Listform.ListformField.Password",
|
||||||
|
Width = 0,
|
||||||
|
ListOrderNo = 10,
|
||||||
|
Visible = false,
|
||||||
|
IsActive = false,
|
||||||
|
|
||||||
|
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||||
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
|
},
|
||||||
|
|
||||||
|
new ListFormField {
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
|
|
@ -1189,29 +1236,11 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
SourceDbType = DbType.Boolean,
|
SourceDbType = DbType.Boolean,
|
||||||
FieldName = "IsActive",
|
FieldName = "IsActive",
|
||||||
EditGroupOrderNo = 1,
|
EditGroupOrderNo = 1,
|
||||||
EditOrderNo = 10,
|
EditOrderNo = 11,
|
||||||
EditorType2 = EditorTypes.dxCheckBox,
|
EditorType2 = EditorTypes.dxCheckBox,
|
||||||
ColSpan = 1,
|
ColSpan = 1,
|
||||||
CaptionName = "App.Listform.ListformField.IsActive",
|
CaptionName = "App.Listform.ListformField.IsActive",
|
||||||
Width = 0,
|
Width = 0,
|
||||||
ListOrderNo = 10,
|
|
||||||
Visible = true,
|
|
||||||
IsActive = true,
|
|
||||||
|
|
||||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
|
||||||
},
|
|
||||||
new ListFormField
|
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
|
||||||
RoleId = null,
|
|
||||||
UserId = null,
|
|
||||||
CultureName = LanguageCodes.En,
|
|
||||||
SourceDbType = DbType.Boolean,
|
|
||||||
FieldName = "IsVerified",
|
|
||||||
CaptionName = "App.Listform.ListformField.IsVerified",
|
|
||||||
Width = 0,
|
|
||||||
ListOrderNo = 11,
|
ListOrderNo = 11,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
|
|
@ -1220,15 +1249,14 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.Boolean,
|
SourceDbType = DbType.Boolean,
|
||||||
FieldName = "EmailConfirmed",
|
FieldName = "IsVerified",
|
||||||
CaptionName = "App.Listform.ListformField.EmailConfirmed",
|
CaptionName = "App.Listform.ListformField.IsVerified",
|
||||||
Width = 0,
|
Width = 0,
|
||||||
ListOrderNo = 12,
|
ListOrderNo = 12,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
|
|
@ -1238,15 +1266,14 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.Boolean,
|
SourceDbType = DbType.Boolean,
|
||||||
FieldName = "TwoFactorEnabled",
|
FieldName = "EmailConfirmed",
|
||||||
CaptionName = "App.Listform.ListformField.TwoFactorEnabled",
|
CaptionName = "App.Listform.ListformField.EmailConfirmed",
|
||||||
Width = 0,
|
Width = 0,
|
||||||
ListOrderNo = 13,
|
ListOrderNo = 13,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
|
|
@ -1256,29 +1283,24 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
new ListFormField
|
new ListFormField {
|
||||||
{
|
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
RoleId = null,
|
RoleId = null,
|
||||||
UserId = null,
|
UserId = null,
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.Boolean,
|
||||||
FieldName = "Password",
|
FieldName = "TwoFactorEnabled",
|
||||||
EditGroupOrderNo = 1,
|
CaptionName = "App.Listform.ListformField.TwoFactorEnabled",
|
||||||
EditOrderNo = 9,
|
|
||||||
EditorType2 = EditorTypes.dxTextBox,
|
|
||||||
ColSpan = 1,
|
|
||||||
CaptionName = "App.Listform.ListformField.Password",
|
|
||||||
Width = 0,
|
Width = 0,
|
||||||
ListOrderNo = 14,
|
ListOrderNo = 14,
|
||||||
Visible = false,
|
Visible = true,
|
||||||
IsActive = false,
|
IsActive = true,
|
||||||
|
|
||||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||||
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false),
|
||||||
PivotSettingsJson = DefaultPivotSettingsJson
|
PivotSettingsJson = DefaultPivotSettingsJson
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@ public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
||||||
adminUser.SetDepartmentId(PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
adminUser.SetDepartmentId(PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
||||||
adminUser.SetJobPositionId(PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
adminUser.SetJobPositionId(PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
||||||
adminUser.SetAvatar(GetAvatar(tenantId?.ToString(), adminUser.Id.ToString()));
|
adminUser.SetAvatar(GetAvatar(tenantId?.ToString(), adminUser.Id.ToString()));
|
||||||
|
adminUser.SetUserType(PlatformConsts.AbpIdentity.User.InternalUserTypeDefaultValue);
|
||||||
|
|
||||||
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
||||||
result.CreatedAdminUser = true;
|
result.CreatedAdminUser = true;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,12 @@ public static class PlatformConsts
|
||||||
public const string React = "UI";
|
public const string React = "UI";
|
||||||
public const char MultiValueDelimiter = '|';
|
public const char MultiValueDelimiter = '|';
|
||||||
|
|
||||||
|
public enum UserType
|
||||||
|
{
|
||||||
|
Internal,
|
||||||
|
External
|
||||||
|
}
|
||||||
|
|
||||||
public static class EditorOptionValues
|
public static class EditorOptionValues
|
||||||
{
|
{
|
||||||
public static string Disabled = "{ \"disabled\" : true }";
|
public static string Disabled = "{ \"disabled\" : true }";
|
||||||
|
|
@ -119,6 +125,7 @@ public static class PlatformConsts
|
||||||
public const string Surname = "Surname";
|
public const string Surname = "Surname";
|
||||||
public const string LoginEndDate = "LoginEndDate";
|
public const string LoginEndDate = "LoginEndDate";
|
||||||
public const string RoleNames = "RoleNames";
|
public const string RoleNames = "RoleNames";
|
||||||
|
public const string UserType = "UserType";
|
||||||
public const string IsVerified = "IsVerified";
|
public const string IsVerified = "IsVerified";
|
||||||
public const string Avatar = "Avatar";
|
public const string Avatar = "Avatar";
|
||||||
public const string RocketUsername = "RocketUsername";
|
public const string RocketUsername = "RocketUsername";
|
||||||
|
|
@ -188,6 +195,9 @@ public static class PlatformConsts
|
||||||
public static readonly DateTime AdminBirthDateDefaultValue = new(1981, 8, 27);
|
public static readonly DateTime AdminBirthDateDefaultValue = new(1981, 8, 27);
|
||||||
public const string AdminBirthPlaceDefaultValue = "Kadıköy, İstanbul";
|
public const string AdminBirthPlaceDefaultValue = "Kadıköy, İstanbul";
|
||||||
public const string AdminMaritalStatusDefaultValue = "Evli";
|
public const string AdminMaritalStatusDefaultValue = "Evli";
|
||||||
|
|
||||||
|
public const UserType InternalUserTypeDefaultValue = PlatformConsts.UserType.Internal;
|
||||||
|
public const UserType ExternalUserTypeDefaultValue = PlatformConsts.UserType.External;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class OrganizationUnits
|
public static class OrganizationUnits
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,16 @@ public static class AbpIdentityUserExtensions
|
||||||
return $"{user.Name} {user.Surname}".Trim();
|
return $"{user.Name} {user.Surname}".Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//UserType
|
||||||
|
public static void SetUserType(this IdentityUser user, PlatformConsts.UserType userType)
|
||||||
|
{
|
||||||
|
user.SetProperty(PlatformConsts.AbpIdentity.User.UserType, userType);
|
||||||
|
}
|
||||||
|
public static PlatformConsts.UserType GetUserType(this IdentityUser user)
|
||||||
|
{
|
||||||
|
return user.GetProperty<PlatformConsts.UserType>(PlatformConsts.AbpIdentity.User.UserType);
|
||||||
|
}
|
||||||
|
|
||||||
//IsVerified
|
//IsVerified
|
||||||
public static void SetIsVerified(this IdentityUser user, bool isVerified)
|
public static void SetIsVerified(this IdentityUser user, bool isVerified)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Volo.Abp.ObjectExtending;
|
||||||
using Volo.Abp.PermissionManagement;
|
using Volo.Abp.PermissionManagement;
|
||||||
using Volo.Abp.TenantManagement;
|
using Volo.Abp.TenantManagement;
|
||||||
using Volo.Abp.Threading;
|
using Volo.Abp.Threading;
|
||||||
|
using static Sozsoft.Platform.PlatformConsts;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.EntityFrameworkCore;
|
namespace Sozsoft.Platform.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|
@ -19,6 +20,15 @@ public static class PlatformEfCoreEntityExtensionMappings
|
||||||
|
|
||||||
OneTimeRunner.Run(() =>
|
OneTimeRunner.Run(() =>
|
||||||
{
|
{
|
||||||
|
ObjectExtensionManager.Instance
|
||||||
|
.MapEfCoreProperty<IdentityUser, UserType>(
|
||||||
|
PlatformConsts.AbpIdentity.User.UserType,
|
||||||
|
(entityBuilder, propertyBuilder) =>
|
||||||
|
{
|
||||||
|
propertyBuilder.IsRequired().HasDefaultValue(PlatformConsts.AbpIdentity.User.InternalUserTypeDefaultValue);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
ObjectExtensionManager.Instance
|
ObjectExtensionManager.Instance
|
||||||
.MapEfCoreProperty<IdentityUser, bool>(
|
.MapEfCoreProperty<IdentityUser, bool>(
|
||||||
PlatformConsts.AbpIdentity.User.IsVerified,
|
PlatformConsts.AbpIdentity.User.IsVerified,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
||||||
namespace Sozsoft.Platform.Migrations
|
namespace Sozsoft.Platform.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PlatformDbContext))]
|
[DbContext(typeof(PlatformDbContext))]
|
||||||
[Migration("20260730174943_Initial")]
|
[Migration("20260731143824_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
@ -7801,6 +7801,11 @@ namespace Sozsoft.Platform.Migrations
|
||||||
.HasColumnType("nvarchar(256)")
|
.HasColumnType("nvarchar(256)")
|
||||||
.HasColumnName("UserName");
|
.HasColumnName("UserName");
|
||||||
|
|
||||||
|
b.Property<int>("UserType")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasDefaultValue(0);
|
||||||
|
|
||||||
b.Property<string>("Village")
|
b.Property<string>("Village")
|
||||||
.HasMaxLength(128)
|
.HasMaxLength(128)
|
||||||
.HasColumnType("nvarchar(128)");
|
.HasColumnType("nvarchar(128)");
|
||||||
|
|
@ -462,6 +462,7 @@ namespace Sozsoft.Platform.Migrations
|
||||||
SerialNo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
SerialNo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
||||||
SskNo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
SskNo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
||||||
TerminationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
TerminationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
UserType = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
|
||||||
Village = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
Village = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
||||||
VolumeNo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
VolumeNo = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
||||||
WorkHour = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
WorkHour = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
|
@ -7798,6 +7798,11 @@ namespace Sozsoft.Platform.Migrations
|
||||||
.HasColumnType("nvarchar(256)")
|
.HasColumnType("nvarchar(256)")
|
||||||
.HasColumnName("UserName");
|
.HasColumnName("UserName");
|
||||||
|
|
||||||
|
b.Property<int>("UserType")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasDefaultValue(0);
|
||||||
|
|
||||||
b.Property<string>("Village")
|
b.Property<string>("Village")
|
||||||
.HasMaxLength(128)
|
.HasMaxLength(128)
|
||||||
.HasColumnType("nvarchar(128)");
|
.HasColumnType("nvarchar(128)");
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@ public class TenantIdentityDataSeeder : IdentityDataSeeder
|
||||||
adminUser.SetDepartmentId(PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
adminUser.SetDepartmentId(PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
||||||
adminUser.SetJobPositionId(PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
adminUser.SetJobPositionId(PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
||||||
adminUser.SetAvatar(GetAvatar(tenantId?.ToString(), adminUser.Id.ToString()));
|
adminUser.SetAvatar(GetAvatar(tenantId?.ToString(), adminUser.Id.ToString()));
|
||||||
|
adminUser.SetUserType(PlatformConsts.AbpIdentity.User.InternalUserTypeDefaultValue);
|
||||||
|
|
||||||
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
||||||
result.CreatedAdminUser = true;
|
result.CreatedAdminUser = true;
|
||||||
|
|
|
||||||
|
|
@ -308,13 +308,19 @@ public class PlatformSignInManager : AbpSignInManager, IPlatformSignInManager
|
||||||
using var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: false);
|
using var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: false);
|
||||||
var sessions = await identitySessionRepository.GetListAsync();
|
var sessions = await identitySessionRepository.GetListAsync();
|
||||||
|
|
||||||
// Bu kullanıcı hariç diğer distinct aktif kullanıcı sayısını hesapla.
|
|
||||||
// Kullanıcının kendi oturumu varsa (refresh) o kişi tekrar sayılmaz.
|
// Kullanıcının kendi oturumu varsa (refresh) o kişi tekrar sayılmaz.
|
||||||
var otherActiveUserCount = sessions
|
var activeUserIds = sessions
|
||||||
.Where(s => s.UserId != user.Id)
|
.Where(s => s.UserId != user.Id)
|
||||||
.Select(s => s.UserId)
|
.Select(s => s.UserId)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.Count();
|
.ToList();
|
||||||
|
|
||||||
|
// Aktif session kullanıcılarını IdentityUserManager üzerinden topluca yükle
|
||||||
|
// ve yalnızca UserType = 0 (Internal) olanları concurrent limite dahil et.
|
||||||
|
var otherActiveUserCount = (await userManager.Users
|
||||||
|
.Where(u => activeUserIds.Contains(u.Id))
|
||||||
|
.ToListAsync())
|
||||||
|
.Count(u => u.GetUserType() == PlatformConsts.UserType.Internal);
|
||||||
|
|
||||||
if (otherActiveUserCount >= maxConcurrentUsers)
|
if (otherActiveUserCount >= maxConcurrentUsers)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ export interface UserInfoViewModel extends ExtensibleObject {
|
||||||
lockoutEnabled: boolean
|
lockoutEnabled: boolean
|
||||||
lockoutEnd?: string
|
lockoutEnd?: string
|
||||||
loginEndDate?: Date | string
|
loginEndDate?: Date | string
|
||||||
|
userType: number
|
||||||
isVerified: boolean
|
isVerified: boolean
|
||||||
userRoleNames: string[]
|
userRoleNames: string[]
|
||||||
roles: AssignedRoleViewModel[]
|
roles: AssignedRoleViewModel[]
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,8 @@ export type SelectBoxOptionWithGroup = {
|
||||||
label?: string
|
label?: string
|
||||||
group?: string
|
group?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type SelectBoxOptionByNumber = {
|
||||||
|
value?: number
|
||||||
|
label?: string
|
||||||
|
}
|
||||||
|
|
@ -76,7 +76,11 @@ import {
|
||||||
import 'react-advanced-cropper/dist/style.css'
|
import 'react-advanced-cropper/dist/style.css'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { SelectBoxOption, SelectBoxOptionWithGroup } from '@/types/shared'
|
import {
|
||||||
|
SelectBoxOption,
|
||||||
|
SelectBoxOptionWithGroup,
|
||||||
|
SelectBoxOptionByNumber,
|
||||||
|
} from '@/types/shared'
|
||||||
import { AdaptableCard, ConfirmDialog } from '@/components/shared'
|
import { AdaptableCard, ConfirmDialog } from '@/components/shared'
|
||||||
import { AssignedClaimViewModel, UserInfoViewModel } from '@/proxy/admin/models'
|
import { AssignedClaimViewModel, UserInfoViewModel } from '@/proxy/admin/models'
|
||||||
import { APP_NAME, AVATAR_URL } from '@/constants/app.constant'
|
import { APP_NAME, AVATAR_URL } from '@/constants/app.constant'
|
||||||
|
|
@ -254,7 +258,7 @@ function UserDetails() {
|
||||||
</TabNav>
|
</TabNav>
|
||||||
</TabList>
|
</TabList>
|
||||||
<TabContent value="user">
|
<TabContent value="user">
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-2">
|
||||||
<Formik
|
<Formik
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
initialValues={userDetails}
|
initialValues={userDetails}
|
||||||
|
|
@ -376,14 +380,33 @@ function UserDetails() {
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem size="sm" label={translate('::RocketUsername')}>
|
<FormItem label={translate('::Abp.Account.UserType')}>
|
||||||
<Field
|
<Field type="number" name="userType">
|
||||||
type="text"
|
{({ field, form }: FieldProps<SelectBoxOptionByNumber>) => {
|
||||||
name="rocketUsername"
|
const userTypes: SelectBoxOptionByNumber[] = [
|
||||||
placeholder={translate('::RocketUsername')}
|
{
|
||||||
component={Input}
|
value: 0,
|
||||||
prefix={<FaFacebookMessenger className="text-xl" />}
|
label: translate('::Abp.Account.UserType.Internal'),
|
||||||
/>
|
},
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: translate('::Abp.Account.UserType.External'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
menuPlacement='top'
|
||||||
|
field={field}
|
||||||
|
form={form}
|
||||||
|
options={userTypes}
|
||||||
|
value={userTypes.filter((o) => o.value === values.userType)}
|
||||||
|
onChange={(option) =>
|
||||||
|
form.setFieldValue(field.name, option?.value ?? null)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</Field>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -510,6 +533,7 @@ function UserDetails() {
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
menuPlacement='top'
|
||||||
field={field}
|
field={field}
|
||||||
form={form}
|
form={form}
|
||||||
options={bloodTypeOptions}
|
options={bloodTypeOptions}
|
||||||
|
|
@ -600,7 +624,7 @@ function UserDetails() {
|
||||||
</TabContent>
|
</TabContent>
|
||||||
|
|
||||||
<TabContent value="permission">
|
<TabContent value="permission">
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-2">
|
||||||
<Formik
|
<Formik
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
initialValues={userDetails}
|
initialValues={userDetails}
|
||||||
|
|
@ -712,7 +736,7 @@ function UserDetails() {
|
||||||
</TabContent>
|
</TabContent>
|
||||||
|
|
||||||
<TabContent value="work">
|
<TabContent value="work">
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-">
|
||||||
<Formik
|
<Formik
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
initialValues={userDetails}
|
initialValues={userDetails}
|
||||||
|
|
@ -808,6 +832,18 @@ function UserDetails() {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<FormItem size="sm" label={translate('::RocketUsername')}>
|
||||||
|
<Field
|
||||||
|
type="text"
|
||||||
|
name="rocketUsername"
|
||||||
|
placeholder={translate('::RocketUsername')}
|
||||||
|
component={Input}
|
||||||
|
prefix={<FaFacebookMessenger className="text-xl" />}
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<FormItem
|
<FormItem
|
||||||
label={translate('::Abp.Identity.User.UserInformation.SskNo')}
|
label={translate('::Abp.Identity.User.UserInformation.SskNo')}
|
||||||
|
|
@ -894,7 +930,7 @@ function UserDetails() {
|
||||||
</TabContent>
|
</TabContent>
|
||||||
|
|
||||||
<TabContent value="identity">
|
<TabContent value="identity">
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-2">
|
||||||
<Formik
|
<Formik
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
initialValues={userDetails}
|
initialValues={userDetails}
|
||||||
|
|
@ -1251,7 +1287,7 @@ function UserDetails() {
|
||||||
</TabContent>
|
</TabContent>
|
||||||
|
|
||||||
<TabContent value="lockout">
|
<TabContent value="lockout">
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-2">
|
||||||
<Formik
|
<Formik
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
initialValues={userDetails}
|
initialValues={userDetails}
|
||||||
|
|
@ -1639,7 +1675,7 @@ function UserDetails() {
|
||||||
</TabContent>
|
</TabContent>
|
||||||
|
|
||||||
<TabContent value="claimTypes">
|
<TabContent value="claimTypes">
|
||||||
<div className="px-4 py-6">
|
<div className="px-4 py-2">
|
||||||
<Table compact>
|
<Table compact>
|
||||||
<THead>
|
<THead>
|
||||||
<Tr>
|
<Tr>
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,12 @@ import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||||
import {
|
import {
|
||||||
ColumnFormatDto,
|
ColumnFormatDto,
|
||||||
DbTypeEnum,
|
DbTypeEnum,
|
||||||
|
FieldCustomValueTypeEnum,
|
||||||
GridDto,
|
GridDto,
|
||||||
PlatformEditorTypes,
|
PlatformEditorTypes,
|
||||||
SubFormTabTypeEnum,
|
SubFormTabTypeEnum,
|
||||||
} from '@/proxy/form/models'
|
} from '@/proxy/form/models'
|
||||||
import { getList } from '@/services/form.service'
|
import { getList, getNextSequenceValue } from '@/services/form.service'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import { usePermission } from '@/utils/hooks/usePermission'
|
import { usePermission } from '@/utils/hooks/usePermission'
|
||||||
import { useStoreActions, useStoreState } from '@/store'
|
import { useStoreActions, useStoreState } from '@/store'
|
||||||
|
|
@ -32,6 +33,7 @@ import DxCardView, {
|
||||||
ToolbarItem,
|
ToolbarItem,
|
||||||
} from 'devextreme-react/card-view'
|
} from 'devextreme-react/card-view'
|
||||||
import CustomStore from 'devextreme/data/custom_store'
|
import CustomStore from 'devextreme/data/custom_store'
|
||||||
|
import type { DataType } from 'devextreme/common'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
|
|
@ -42,6 +44,7 @@ import { GridExtraFilterToolbar } from './GridExtraFilterToolbar'
|
||||||
import { ImageUploadEditorComponent } from './editors/ImageUploadEditorComponent'
|
import { ImageUploadEditorComponent } from './editors/ImageUploadEditorComponent'
|
||||||
import { ImageViewerEditorComponent } from './editors/ImageViewerEditorComponent'
|
import { ImageViewerEditorComponent } from './editors/ImageViewerEditorComponent'
|
||||||
import {
|
import {
|
||||||
|
autoNumber,
|
||||||
extractSearchParamsFields,
|
extractSearchParamsFields,
|
||||||
getEditingFormGroups,
|
getEditingFormGroups,
|
||||||
GridExtraFilterState,
|
GridExtraFilterState,
|
||||||
|
|
@ -417,7 +420,9 @@ const CardView = (props: CardViewProps) => {
|
||||||
const [isPopupFullScreen, setIsPopupFullScreen] = useState(false)
|
const [isPopupFullScreen, setIsPopupFullScreen] = useState(false)
|
||||||
const [formData, setFormData] = useState<Record<string, any>>()
|
const [formData, setFormData] = useState<Record<string, any>>()
|
||||||
const formDataRef = useRef<Record<string, any>>()
|
const formDataRef = useRef<Record<string, any>>()
|
||||||
formDataRef.current = formData
|
useEffect(() => {
|
||||||
|
formDataRef.current = formData
|
||||||
|
}, [formData])
|
||||||
const lookupDisplayValuesRef = useRef<Record<string, Map<string, string>>>({})
|
const lookupDisplayValuesRef = useRef<Record<string, Map<string, string>>>({})
|
||||||
const [lookupReadyState, setLookupReadyState] = useState({ listFormCode, ready: false })
|
const [lookupReadyState, setLookupReadyState] = useState({ listFormCode, ready: false })
|
||||||
const [notePanelTarget, setNotePanelTarget] = useState<{
|
const [notePanelTarget, setNotePanelTarget] = useState<{
|
||||||
|
|
@ -689,7 +694,6 @@ const CardView = (props: CardViewProps) => {
|
||||||
nextData[childField] = null
|
nextData[childField] = null
|
||||||
})
|
})
|
||||||
formDataRef.current = nextData
|
formDataRef.current = nextData
|
||||||
setFormData(nextData)
|
|
||||||
},
|
},
|
||||||
[cascadeChildrenByParent],
|
[cascadeChildrenByParent],
|
||||||
)
|
)
|
||||||
|
|
@ -859,7 +863,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
...editorOptions,
|
...editorOptions,
|
||||||
dataSource:
|
dataSource:
|
||||||
typeof lookup.dataSource === 'function'
|
typeof lookup.dataSource === 'function'
|
||||||
? lookup.dataSource({ data: formData ?? {} })
|
? lookup.dataSource({ data: formDataRef.current ?? {} })
|
||||||
: lookup.dataSource,
|
: lookup.dataSource,
|
||||||
displayExpr: lookup.displayExpr,
|
displayExpr: lookup.displayExpr,
|
||||||
valueExpr: lookup.valueExpr,
|
valueExpr: lookup.valueExpr,
|
||||||
|
|
@ -892,7 +896,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
: undefined,
|
: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[formData, gridDto, imageUploadFormTemplate, imageViewerFormTemplate, mode, translate],
|
[gridDto, imageUploadFormTemplate, imageViewerFormTemplate, mode, translate],
|
||||||
)
|
)
|
||||||
|
|
||||||
const editingFormItems = useMemo(() => {
|
const editingFormItems = useMemo(() => {
|
||||||
|
|
@ -1009,6 +1013,86 @@ const CardView = (props: CardViewProps) => {
|
||||||
const editingOptions = gridDto?.gridOptions.editingOptionDto
|
const editingOptions = gridDto?.gridOptions.editingOptionDto
|
||||||
const selectionOptions = gridDto?.gridOptions.selectionDto
|
const selectionOptions = gridDto?.gridOptions.selectionDto
|
||||||
|
|
||||||
|
const onInitNewCard = useCallback(
|
||||||
|
(event: CardViewTypes.InitNewCardEvent<Record<string, any>>) => {
|
||||||
|
const nextFormData = event.data as Record<string, any>
|
||||||
|
formDataRef.current = nextFormData
|
||||||
|
|
||||||
|
setMode('new')
|
||||||
|
setIsPopupFullScreen(useMobileEditPopup || (editingOptions?.popup?.fullScreen ?? false))
|
||||||
|
|
||||||
|
event.promise = (async () => {
|
||||||
|
const rawFilter = searchParamsRef.current?.get('filter')
|
||||||
|
let filters: any[] = []
|
||||||
|
|
||||||
|
if (rawFilter) {
|
||||||
|
try {
|
||||||
|
filters = extractSearchParamsFields(JSON.parse(rawFilter))
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Filter parse edilemedi:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const column of gridDto?.columnFormats ?? []) {
|
||||||
|
const fieldName = column.fieldName
|
||||||
|
if (!fieldName || extraFilters.some((filter) => filter.fieldName === fieldName)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (column.defaultValue !== null && column.defaultValue !== undefined) {
|
||||||
|
if (typeof column.defaultValue === 'string' && column.defaultValue === '@AUTONUMBER') {
|
||||||
|
nextFormData[fieldName] = autoNumber()
|
||||||
|
} else if (column.defaultValueType === FieldCustomValueTypeEnum.Sequence) {
|
||||||
|
try {
|
||||||
|
const response = await getNextSequenceValue(String(column.defaultValue))
|
||||||
|
nextFormData[fieldName] = response.data
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Sequence default value alınamadı:', {
|
||||||
|
fieldName,
|
||||||
|
defaultValue: column.defaultValue,
|
||||||
|
error,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nextFormData[fieldName] = column.defaultValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldMatch = filters.find(([field]) => field === fieldName)
|
||||||
|
if (!fieldMatch) continue
|
||||||
|
|
||||||
|
const value = fieldMatch[2]
|
||||||
|
switch (column.dataType as DataType) {
|
||||||
|
case 'date':
|
||||||
|
case 'datetime':
|
||||||
|
nextFormData[fieldName] = new Date(value)
|
||||||
|
break
|
||||||
|
case 'number':
|
||||||
|
nextFormData[fieldName] = Number(value)
|
||||||
|
break
|
||||||
|
case 'boolean':
|
||||||
|
nextFormData[fieldName] = value === true || value === 'true'
|
||||||
|
break
|
||||||
|
case 'object':
|
||||||
|
try {
|
||||||
|
nextFormData[fieldName] = JSON.parse(value)
|
||||||
|
} catch {
|
||||||
|
nextFormData[fieldName] = value
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
nextFormData[fieldName] = value
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
formDataRef.current = nextFormData
|
||||||
|
setFormData({ ...nextFormData })
|
||||||
|
})()
|
||||||
|
},
|
||||||
|
[editingOptions?.popup?.fullScreen, extraFilters, gridDto, useMobileEditPopup],
|
||||||
|
)
|
||||||
|
|
||||||
const onSelectionChanged = useCallback(
|
const onSelectionChanged = useCallback(
|
||||||
(event: CardViewTypes.SelectionChangedEvent) => {
|
(event: CardViewTypes.SelectionChangedEvent) => {
|
||||||
const selectedCardsData = event.selectedCardsData as Record<string, any>[]
|
const selectedCardsData = event.selectedCardsData as Record<string, any>[]
|
||||||
|
|
@ -1074,15 +1158,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
wordWrapEnabled={gridDto.gridOptions.rowDto?.whiteSpace !== 'nowrap'}
|
wordWrapEnabled={gridDto.gridOptions.rowDto?.whiteSpace !== 'nowrap'}
|
||||||
onContentReady={onContentReady}
|
onContentReady={onContentReady}
|
||||||
onSelectionChanged={onSelectionChanged}
|
onSelectionChanged={onSelectionChanged}
|
||||||
onInitNewCard={(event) => {
|
onInitNewCard={onInitNewCard}
|
||||||
const nextFormData = (event.data as Record<string, any>) ?? {}
|
|
||||||
formDataRef.current = nextFormData
|
|
||||||
setFormData(nextFormData)
|
|
||||||
setMode('new')
|
|
||||||
setIsPopupFullScreen(
|
|
||||||
useMobileEditPopup || (editingOptions?.popup?.fullScreen ?? false),
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
onEditingStart={(event) => {
|
onEditingStart={(event) => {
|
||||||
const nextFormData = (event.data as Record<string, any>) ?? {}
|
const nextFormData = (event.data as Record<string, any>) ?? {}
|
||||||
formDataRef.current = nextFormData
|
formDataRef.current = nextFormData
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue