Skip to content

Commit 2809a79

Browse files
committed
Few tidy ups and CSV file defining the Name / Value of each localized message / error
1 parent 757ee2d commit 2809a79

File tree

9 files changed

+344
-26
lines changed

9 files changed

+344
-26
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
Name,Value,Comment
2+
AuthRolesAdminService_CreateRoleToPermissionsAsync_Success,Successfully added the new role {0}.,AuthPermissions project
3+
AuthRolesAdminService_CreateRoleToPermissionsAsync_BadRoleName,The RoleName isn't filled in,
4+
AuthRolesAdminService_CreateRoleToPermissionsAsync_DuplicateRoleName,There is already a Role with the name of '{0}'.,
5+
AuthRolesAdminService_NoPermissions,You must provide at least one permission name.,
6+
AuthRolesAdminService_InvalidPermission,The permission name '{0}' isn't a valid name in the {1} enum.,
7+
AuthRolesAdminService_UpdateRoleToPermissionsAsync_Success,Successfully updated the role {0}.,
8+
AuthRolesAdminService_IncorrectRoleName,Could not find a role called {0},
9+
AuthRolesAdminService_DeleteRoleAsync_RoleUsedUser,That role is used in {0} AuthUsers and you didn't confirm the delete.,
10+
AuthRolesAdminService_DeleteRoleAsync_RoleUsedTenant,That role is used in {0} tenants and you didn't confirm the delete.,
11+
AuthRolesAdminService_DeleteRoleAsync_Success,Successfully deleted the role {0}.,
12+
AuthRolesAdminService_DeleteRoleAsync_Success-RemoveUsers,Successfully deleted the role {0} and removed that role from {0} users.,
13+
AuthRolesAdminService_DeleteRoleAsync_Success-RemoveTenants,Successfully deleted the role {0} and removed that role from {0} tenants..,
14+
AuthRolesAdminService_DeleteRoleAsync_Success-RemoveUsers-RemoveTenants,Successfully deleted the role {0} and removed that role from {0} users and removed that role from {0} tenants.,
15+
AuthTenantAdminService_TenantNotFound,Could not find the tenant you were looking for.,
16+
AuthTenantAdminService_AddSingleTenantAsync_Success,Successfully added the new tenant {0}.,
17+
AuthTenantAdminService_AddSingleTenantAsync_HasOwnDbInvalid,The 'hasOwnDb' parameter must be set to true or false when sharding is turned on.,
18+
AuthTenantAdminService_AddSingleTenantAsync_ExceptionFail,The attempt to create a tenant failed with a system error. Please contact the admin team.,
19+
AuthTenantAdminService_AddHierarchicalTenantAsync_NameBadChar,The tenant name must not contain the character '|' because that character is used to separate the names in the hierarchical order.,
20+
AuthTenantAdminService_ParentNotFound,Could not find the parent tenant you asked for.,
21+
AuthTenantAdminService_AddHierarchicalTenantAsync_Success,Successfully added the new hierarchical tenant {0}.,
22+
AuthTenantAdminService_AddHierarchicalTenantAsync_InvalidHasOwnDb,The {0} parameter doesn't match the parent's {0}. Set the {1} parameter to null to use the parent's {0} value.,
23+
AuthTenantAdminService_AddHierarchicalTenantAsync_InvalidDatabaseInfoName,The {0} parameter doesn't match the parent's {0}. Set the {1} parameter to null to use the parent's {0} value.,
24+
AuthTenantAdminService_AddHierarchicalTenantAsync_HasOwnDbNotSet,The hasOwnDb parameter must be set to true or false if there is no parent and sharding is turned on.,
25+
AuthTenantAdminService_UpdateTenantRolesAsync_Success,Successfully updated the tenant's Roles.,
26+
AuthTenantAdminService_UpdateTenantNameAsync_Success,Successfully updated the tenant's name to {0}.,
27+
AuthTenantAdminService_UpdateTenantNameAsync_TenantNameEmpty,The new tenant name was empty.,
28+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_Success,Successfully moved the tenant to the database defined by the database information with the name '{0}'.,
29+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_ChildIsInvalid,"For hierarchical tenants you must provide the top tenant's TenantId, not a child tenant.",
30+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_NoMoveToSelf,You cannot move a tenant to itself.,
31+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_ParentIsChild,You cannot move a tenant one of its children.,
32+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_NoChange,"You didn't change any of the sharding parts, so nothing was changed.",
33+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_SuccessNotMoved,The tenant wasn't moved but its {0} was changed to {1}.,
34+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_Success-ToTenant,Successfully moved the tenant originally named '{0}' to the new named '{0}'.,
35+
AuthTenantAdminService_MoveHierarchicalTenantToAnotherParentAsync_Success-ToTop,Successfully moved the tenant originally named '{0}' to top level.,
36+
AuthTenantAdminService_DeleteTenantAsync_BeingUsedAbort,This delete is aborted because this {0} linked to the user '{1}'.,
37+
AuthTenantAdminService_DeleteTenantAsync_Success,Successfully deleted the tenant called '{0}'.,
38+
AuthTenantAdminService_DeleteTenantAsync_Success-AndLinked,Successfully deleted the tenant called '{0}' and its {0} linked tenants.,
39+
AuthTenantAdminService_MoveToDifferentDatabaseAsync_Success,The tenant wasn't moved but its {0} was changed to {1}.,
40+
AuthTenantAdminService_MoveToDifferentDatabaseAsync_ChildIsInvalid,"For hierarchical tenants you must provide the top tenant's TenantId, not a child tenant.",
41+
AuthTenantAdminService_MoveToDifferentDatabaseAsync_NoChange,"You didn't change any of the sharding parts, so nothing was changed.",
42+
AuthTenantAdminService_MoveToDifferentDatabaseAsync_SuccessNotMoved,The tenant wasn't moved but its {0} was changed to {1}.,
43+
AuthTenantAdminService_CheckHasOwnDbIsValidAsync_InvalidDatabase,"The {0} parameter is true, but the sharding database name '{0}' already has tenant(s) using that database.",
44+
AuthTenantAdminService_GetRolesWithChecksAsync_RoleNotFound,The Role '{0}' was not found in the lists of Roles.,
45+
AuthUsersAdminService_UserNotFound,Could not find the User you asked for.,
46+
AuthUsersAdminService_FindAuthUserByEmailAsync_UserNotFoundEmail,Could not find the AuthP User with the email of '{0}'.,
47+
AuthUsersAdminService_UpdateDisabledAsync_Success,Successfully changed the user's {0} to {1}.,
48+
AuthUsersAdminService_AddNewUserAsync_Success,Successfully added a AuthUser with the name '{0}'.,
49+
AuthUsersAdminService_InvalidEmail,The email '{0}' is not a valid email.,
50+
AuthUsersAdminService_TenantNotFound,A tenant with the name '{0}' wasn't found.,
51+
AuthUsersAdminService_UpdateUserAsync_Success,Successfully updated a AuthUser with the name {0l},
52+
AuthUsersAdminService_DeleteUserAsync_Success,Successfully deleted the user '{0}'.,
53+
AuthUsersAdminService_ApplySyncChangesAsync_Success,Sync successful: {0}.,
54+
AuthUsersAdminService_FindCheckRolesAreValidForUserAsync_RoleNotFound,The Role '{0}' was not found in the lists of Roles.,
55+
AuthUsersAdminService_FindCheckRolesAreValidForUserAsync_NonTenantNotAllowed,The role '{0}' wasn't found in the tenant '{1}' tenant roles.,
56+
AuthUsersAdminService_FindCheckRolesAreValidForUserAsync_TenantNotAllowed,The role '{0}' isn't allowed to tenant user.,
57+
AuthUsersAdminService_FindCheckRolesAreValidForUserAsync_RoleNotFoundTenant,The role '{0}' wasn't found in the tenant '{1}' tenant roles.,
58+
ChangeRoleTypeChecks_UserError,You can't change Role {0} from {1} to {2} because {3} users are linked to it.,
59+
ChangeRoleTypeChecks_TenantError,You can't change Role {0} from {1} to {2} because {3} tenants are linked to it.,
60+
LinkToTenantDataService_UserNotFound,Could not find the user you were looking for.,AuthPermissions.AspNetCore project
61+
LinkToTenantDataService_TenantNotFound,Could not find the tenant you were looking for.,
62+
LinkToTenantDataService_Success,You are now linked the the data of the tenant called '{0}',
63+
ShardingConnections_NoConnectionString,The {0} '{1}' wasn't found in the connection strings.,
64+
ShardingConnections_BadConnectionString,There was an� error when trying to create a connection string. Typically this is because the connection string doesn't match the {0}.,
65+
ShardingConnections_NoDatabaseDefined,The DatabaseName can't be null or empty when the connection string doesn't have a database defined.,
66+
AuthUser_InvalidRoleHidden,You cannot add the role '{0}' to an Auth tenant user because it can only be used by the App Admin.,
67+
AuthUser_InvalidRoleAutoAdd,You cannot add the role '{0}' to an Auth tenant user because it is automatically to tenant users.,AuthPermissions.BaseCode project
68+
Tenant_RoleNotTenantRole,"The Role '{0}' is not a tenant role, i.e. only roles with a {1} of {2)} or {3} can be added to a tenant.",
69+
SaveChangesExtensions_DuplicateDb,There is already a {0} with a value: name = {1},
70+
SaveChangesExtensions_ConcurrencyError,Another user changed the {0} with the name = {1}. Please re-read the entity and add you change again.,
71+
SaveChangesExtensions_UnknownException,There was a {0} on an auth class.,
72+
AzureAdNewUserManager_ExistingUser,"There is already an AuthUser with your email, so you can't add another.",AuthPermissions.SupportCode project
73+
AzureAdNewUserManager_SuccessFoundUser,Successfully found your Azure Ad user. Now login via the 'sign in' link.,
74+
AzureAdNewUserManager_SuccessCreatedUser,Successfully created your Azure Ad user. Now login via the 'sign in' link.,
75+
IndividualUserAddUserManager_ExistingUser,"There is already an AuthUser with your email, so you can't add another.",
76+
IndividualUserAddUserManager_SuccessAddUser,New user with claims added.,
77+
IndividualUserAddUserManager_ExistUserBadPassword,Your user is invalid.,
78+
IndividualUserAddUserManager_SuccessRegisterLogin,You have been registered and logged in to this application.,
79+
InviteNewUserService_EmptyEmailOrUserName,You must provide an email or username for the invitation.,
80+
InviteNewUserService_InvalidTenant,The Tenant you have selected isn't within your group.,
81+
InviteNewUserService_SelectTenant,You forgot to select a tenant for the invite.,
82+
InviteNewUserService_BadTenant,The tenant you selected isn't correct.,
83+
InviteNewUserService_BadRoles,The following Roles aren't allowed for a tenant user: {0},
84+
InviteNewUserService_NoRoles,"You haven't set up any Roles for the invited user. If you really what the user to have no roles, then select the '{0}' dropdown item.",
85+
InviteNewUserService_Success-WarningAdminUser,"WARNING: you are creating an invite that will make the user an app admin (i.e. not a tenant). This is allowable, but only send the invite if you are sure that what you want to do.",
86+
InviteNewUserService_Success-SendInviteApp,Please send the url to the user '{0}' which allow them to join your application.,
87+
InviteNewUserService_Success-SendInviteTenant,Please send the url to the user '{0}' which allow them to join the tenant '{1}'.,
88+
InviteNewUserService_Success-WarningAdminUser-Expires,"WARNING: you are creating an invite that will make the user an app admin (i.e. not a tenant). This is allowable, but only send the invite if you are sure that what you want to do. This invite expires on local time {0}.",
89+
InviteNewUserService_Success-SendInviteApp-Expires,Please send the url to the user '{0}' which allow them to join your application. This invite expires on local time {1}.,
90+
InviteNewUserService_Success-SendInviteTenant-Expires,Please send the url to the user '{0}' which allow them to join the tenant '{1}'. This invite expires on local time {1}.,
91+
InviteNewUserService_VerityFailed,"Sorry, the verification failed.",
92+
InviteNewUserService_EmailNotMatch,"Sorry, your email didn't match the invite.",
93+
InviteNewUserService_InviteExpired,The invite has expired. Please contact the person who sent you an invite.,
94+
InviteNewUserService_Forever,Invite is valid forever.,
95+
InviteNewUserService_Expiration-1Hour,Invite is only valid for 1 hour from now.,
96+
InviteNewUserService_Expiration-Hours,Invite is only valid for {0} hours from now.,
97+
InviteNewUserService_Expiration-Days,Invite is only valid for {0} days from now.,
98+
SignInAndCreateTenant_NullTenantName,You forgot to give a tenant name.,
99+
SignInAndCreateTenant_DuplicateTenantName,The tenant name '{0}' is already taken.,
100+
SignInAndCreateTenant_HasOwnDbNotSet,You must set the HasOwnDb parameter to true or false.,
101+
SignInAndCreateTenant_SuccessSignUp,Successfully created the tenant '{0}' and registered you as the tenant admin.,
102+
AzureAdAccessService_BadEmail,The email was either missing or does not contain a '@'.,
103+
AzureAdAccessService_BadAuthorization,The Azure AD authorization service says: {0},
104+
AzureAdAccessService_MissingDatabaseInfo,Could not find a database info entry with the {0} of '{1}'.,
105+
AccessDatabaseInformation_NoDeleteAsUsed,You can't delete the database information with the {0} of {1} because {2} tenant(s) uses this database.,
106+
AccessDatabaseInformation_SuccessUpdate,Successfully updated the {0} with your changes.,
107+
AccessDatabaseInformation_DbNameMissing,"The Name is null, which isn't allowed.",
108+
AccessDatabaseInformation_DatabaseInfoDuplicate,The {0} of {1} is already used.,
109+
DemoGetDatabaseForNewTenant_NoDbForTenant,We cannot create the tenant at this time. Please contact the support team with the code: no db available.,

AuthPermissions.SupportCode/AddUsersServices/Authentication/AzureAdNewUserManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<IStatusGeneric> CheckNoExistingAuthUserAsync(AddNewUserDto new
6565
{
6666
var status = new StatusGenericLocalizer(_localizeDefault);
6767
if ((await _authUsersAdmin.FindAuthUserByEmailAsync(newUser.Email))?.Result != null)
68-
return status.AddErrorString("ExistingUser".ClassLocalizeKey(this, true),
68+
return status.AddErrorString("ExistingUser".ClassLocalizeKey(this, true), //common
6969
"There is already an AuthUser with your email, so you can't add another.",
7070
nameof(AddNewUserDto.Email));
7171
return status;

AuthPermissions.SupportCode/AddUsersServices/Authentication/IndividualUserAddUserManager.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<IStatusGeneric> CheckNoExistingAuthUserAsync(AddNewUserDto new
6565
{
6666
var status = new StatusGenericLocalizer(_localizeDefault);
6767
if ((await _authUsersAdmin.FindAuthUserByEmailAsync(newUser.Email))?.Result != null)
68-
return status.AddErrorString("ExistingUser".ClassLocalizeKey(this, true),
68+
return status.AddErrorString("ExistingUser".ClassLocalizeKey(this, true), //common message
6969
"There is already an AuthUser with your email, so you can't add another.",
7070
nameof(AddNewUserDto.Email));
7171
return status;
@@ -85,7 +85,7 @@ public async Task<IStatusGeneric> SetUserInfoAsync(AddNewUserDto newUser)
8585

8686
var status = new StatusGenericLocalizer(_localizeDefault);
8787
status.SetMessageString("SuccessAddUser".ClassLocalizeKey(this, true),
88-
"New user with claims added");
88+
"New user with claims added.");
8989

9090
var user = await _userManager.FindByEmailAsync(newUser.Email);
9191
if (user == null)
@@ -100,7 +100,8 @@ public async Task<IStatusGeneric> SetUserInfoAsync(AddNewUserDto newUser)
100100
}
101101
else if (!await _userManager.CheckPasswordAsync(user, newUser.Password))
102102
status.AddErrorString("ExistUserBadPassword".ClassLocalizeKey(this, true),
103-
"The user was already known, but the password was wrong.",
103+
//the problem is that the user was already known, but the password was wrong
104+
"Your user is invalid.",
104105
nameof(AddNewUserDto.Password));
105106

106107
//We have created the individual user account, so we have the user's UserId.

AuthPermissions.SupportCode/AddUsersServices/InviteNewUserService.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ public List<KeyValuePair<long, string>> ListOfExpirationTimes()
6262
_localizeDefault.LocalizeStringMessage("Forever".ClassLocalizeKey(this, true),
6363
"Invite is valid forever.")));
6464
result.Add(new(DateTime.UtcNow.AddHours(1).Ticks,
65-
_localizeDefault.LocalizeStringMessage("1Hour".ClassLocalizeKey(this, true),
65+
_localizeDefault.LocalizeStringMessage("Expiration-1Hour".ClassLocalizeKey(this, true),
6666
"Invite is only valid for 1 hour from now.")));
6767
result.Add(new(DateTime.UtcNow.AddHours(1).Ticks,
68-
_localizeDefault.LocalizeStringMessage("6Hour".ClassLocalizeKey(this, true),
69-
"Invite is only valid for 6 hours from now.")));
68+
_localizeDefault.LocalizeFormattedMessage("Expiration-Hours".ClassLocalizeKey(this, true),
69+
$"Invite is only valid for {6} hours from now.")));
7070
result.Add(new(DateTime.UtcNow.AddHours(1).Ticks,
71-
_localizeDefault.LocalizeStringMessage("24Hour".ClassLocalizeKey(this, true),
72-
"Invite is only valid for 24 hours from now.")));
71+
_localizeDefault.LocalizeFormattedMessage("Expiration-Hours".ClassLocalizeKey(this, true),
72+
$"Invite is only valid for {24} hours from now.")));
7373

7474
foreach (var numDays in new[]{3, 7, 20})
7575
{
7676
result.Add(new(DateTime.UtcNow.AddHours(1).Ticks,
77-
_localizeDefault.LocalizeStringMessage($"{numDays}Days".ClassLocalizeKey(this, true),
77+
_localizeDefault.LocalizeFormattedMessage("Expiration-Days".ClassLocalizeKey(this, true),
7878
$"Invite is only valid for {numDays} days from now.")));
7979
}
8080

@@ -179,25 +179,25 @@ public async Task<IStatusGeneric<string>> CreateInviteUserToJoinAsync(AddNewUser
179179
// invitedUser.Roles = null;
180180

181181
var messages = new List<FormattableString>();
182-
string localKey = null;
182+
string successEndingKey = null;
183183

184184
if (invitedUser.TenantId == null && _options.TenantType.IsMultiTenant())
185185
{
186-
localKey = "WarningAdminUser";
186+
successEndingKey = "WarningAdminUser";
187187
messages.Add($"WARNING: you are creating an invite that will make the user an app admin (i.e. not a tenant). ");
188188
messages.Add($"This is allowable, but only send the invite if you are sure that what you want to do.");
189189
}
190190
else
191191
{
192192
if (invitedUser.TenantId == null)
193193
{
194-
localKey = "SendInviteApp";
194+
successEndingKey = "SendInviteApp";
195195
messages.Add(
196196
$"Please send the url to the user '{invitedUser.Email ?? invitedUser.UserName}' which allow them to join your application.");
197197
}
198198
else
199199
{
200-
localKey = "SendInviteTenant";
200+
successEndingKey = "SendInviteTenant";
201201
messages.Add(
202202
$"Please send the url to the user '{invitedUser.Email ?? invitedUser.UserName}' which allow them to join the tenant '{foundTenant.TenantFullName}'.");
203203

@@ -207,11 +207,11 @@ public async Task<IStatusGeneric<string>> CreateInviteUserToJoinAsync(AddNewUser
207207

208208
if (invitedUser.TimeInviteExpires != default)
209209
{
210-
localKey += "-Expires";
210+
successEndingKey += "-Expires";
211211
messages.Add($" This invite expires on local time {new DateTime(invitedUser.TimeInviteExpires).ToLocalTime():g}.");
212212
}
213213

214-
status.SetMessageFormatted(localKey.ClassLocalizeKey(this, true), messages.ToArray());
214+
status.SetMessageFormatted(("Success-"+successEndingKey).ClassLocalizeKey(this, true), messages.ToArray());
215215

216216
//This setting makes the string shorter
217217
JsonSerializerOptions options = new() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault };

0 commit comments

Comments
 (0)