commit
f3e2177423
53
.editorconfig
Normal file
53
.editorconfig
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = crlf
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{json,csproj,props,targets}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
# Prefer "var" everywhere
|
||||||
|
csharp_style_var_for_built_in_types = true : suggestion
|
||||||
|
csharp_style_var_when_type_is_apparent = true : suggestion
|
||||||
|
csharp_style_var_elsewhere = true : suggestion
|
||||||
|
|
||||||
|
# Newline settings
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
csharp_new_line_before_members_in_object_initializers = true
|
||||||
|
csharp_new_line_before_members_in_anonymous_types = true
|
||||||
|
|
||||||
|
# Sort using and Import directives with System.* appearing first
|
||||||
|
dotnet_sort_system_directives_first = true
|
||||||
|
|
||||||
|
# Avoid "this." if not necessary
|
||||||
|
dotnet_style_qualification_for_field = false : suggestion
|
||||||
|
dotnet_style_qualification_for_property = false : suggestion
|
||||||
|
dotnet_style_qualification_for_method = false : suggestion
|
||||||
|
dotnet_style_qualification_for_event = false : suggestion
|
||||||
|
|
||||||
|
# Use language keywords instead of framework type names for type references
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion
|
||||||
|
dotnet_style_predefined_type_for_member_access = false : suggestion
|
||||||
|
|
||||||
|
# Suggest more modern language features when available
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true : none
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true : none
|
||||||
|
csharp_style_inlined_variable_declaration = true : none
|
||||||
|
csharp_style_throw_expression = true : none
|
||||||
|
csharp_style_conditional_delegate_call = true : none
|
||||||
|
|
||||||
|
dotnet_style_object_initializer = true : suggestion
|
||||||
|
dotnet_style_collection_initializer = true : suggestion
|
||||||
|
dotnet_style_coalesce_expression = true : suggestion
|
||||||
|
dotnet_style_null_propagation = true : suggestion
|
||||||
|
dotnet_style_explicit_tuple_names = true : suggestion
|
||||||
|
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
|
@ -8,7 +8,7 @@
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Module module = await ModuleService.GetModuleAsync(ModuleState.ModuleId);
|
Module module = await ModuleService.GetModuleAsync(ModuleState.ModuleId);
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, Constants.HostRole))
|
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||||
{
|
{
|
||||||
string message = "A Problem Was Encountered Loading Module " + module.ModuleDefinitionName;
|
string message = "A Problem Was Encountered Loading Module " + module.ModuleDefinitionName;
|
||||||
AddModuleMessage(message, MessageType.Error);
|
AddModuleMessage(message, MessageType.Error);
|
||||||
|
|
|
@ -88,7 +88,7 @@ else
|
||||||
Role role = await RoleService.GetRoleAsync(roleid);
|
Role role = await RoleService.GetRoleAsync(roleid);
|
||||||
name = role.Name;
|
name = role.Name;
|
||||||
users = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
users = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
||||||
users = users.Where(item => item.Role.Name == Constants.RegisteredRole).ToList();
|
users = users.Where(item => item.Role.Name == RoleNames.Registered).ToList();
|
||||||
await GetUserRoles();
|
await GetUserRoles();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -216,7 +216,7 @@ else
|
||||||
private string _username = string.Empty;
|
private string _username = string.Empty;
|
||||||
private string _password = string.Empty;
|
private string _password = string.Empty;
|
||||||
private bool _integratedsecurity = true;
|
private bool _integratedsecurity = true;
|
||||||
private string _hostusername = Constants.HostUser;
|
private string _hostusername = UserNames.Host;
|
||||||
private string _hostpassword = string.Empty;
|
private string _hostpassword = string.Empty;
|
||||||
|
|
||||||
private string _name = string.Empty;
|
private string _name = string.Empty;
|
||||||
|
@ -311,7 +311,7 @@ else
|
||||||
// validate host credentials
|
// validate host credentials
|
||||||
var user = new User();
|
var user = new User();
|
||||||
user.SiteId = PageState.Site.SiteId;
|
user.SiteId = PageState.Site.SiteId;
|
||||||
user.Username = Constants.HostUser;
|
user.Username = UserNames.Host;
|
||||||
user.Password = _hostpassword;
|
user.Password = _hostpassword;
|
||||||
user = await UserService.LoginUserAsync(user, false, false);
|
user = await UserService.LoginUserAsync(user, false, false);
|
||||||
if (user.IsAuthenticated)
|
if (user.IsAuthenticated)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<Label For="name" HelpText="The name of the tenant">Name: </Label>
|
<Label For="name" HelpText="The name of the tenant">Name: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if (name == Constants.MasterTenant)
|
@if (name == TenantNames.Master)
|
||||||
{
|
{
|
||||||
<input id="name" class="form-control" @bind="@name" readonly />
|
<input id="name" class="form-control" @bind="@name" readonly />
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ else
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.TenantId.ToString())" /></td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.TenantId.ToString())" /></td>
|
||||||
<td><ActionDialog Header="Delete Tenant" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Tenant?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTenant(context))" Disabled="@(context.Name == Constants.MasterTenant)" /></td>
|
<td><ActionDialog Header="Delete Tenant" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Tenant?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTenant(context))" Disabled="@(context.Name == TenantNames.Master)" /></td>
|
||||||
<td>@context.Name</td>
|
<td>@context.Name</td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
|
|
|
@ -79,7 +79,7 @@ else
|
||||||
@foreach (Profile profile in profiles)
|
@foreach (Profile profile in profiles)
|
||||||
{
|
{
|
||||||
var p = profile;
|
var p = profile;
|
||||||
if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole))
|
if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
|
||||||
{
|
{
|
||||||
if (p.Category != category)
|
if (p.Category != category)
|
||||||
{
|
{
|
||||||
|
@ -299,7 +299,7 @@ else
|
||||||
{
|
{
|
||||||
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
|
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
|
||||||
}
|
}
|
||||||
if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole))
|
if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
|
||||||
{
|
{
|
||||||
if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
|
if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,10 +58,10 @@ else
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_search))
|
if (string.IsNullOrEmpty(_search))
|
||||||
{
|
{
|
||||||
return allroles.Where(item => item.Role.Name == Constants.RegisteredRole).ToList();
|
return allroles.Where(item => item.Role.Name == RoleNames.Registered).ToList();
|
||||||
}
|
}
|
||||||
return allroles
|
return allroles
|
||||||
.Where(item => item.Role.Name == Constants.RegisteredRole &&
|
.Where(item => item.Role.Name == RoleNames.Registered &&
|
||||||
(
|
(
|
||||||
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
|
|
@ -63,7 +63,7 @@ else
|
||||||
<Row>
|
<Row>
|
||||||
<td>@context.Role.Name</td>
|
<td>@context.Role.Name</td>
|
||||||
<td>
|
<td>
|
||||||
@if (context.Role.Name != Constants.RegisteredRole)
|
@if (context.Role.Name != RoleNames.Registered)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>Delete</button>
|
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>Delete</button>
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,10 +134,10 @@
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Host:
|
case SecurityAccessLevel.Host:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, RoleNames.Host);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,10 +135,10 @@
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Host:
|
case SecurityAccessLevel.Host:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, RoleNames.Host);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
_haseditpermission = false;
|
_haseditpermission = false;
|
||||||
if (!string.IsNullOrEmpty(Folder))
|
if (!string.IsNullOrEmpty(Folder))
|
||||||
{
|
{
|
||||||
_haseditpermission = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
|
_haseditpermission = UserSecurity.IsAuthorized(PageState.User, RoleNames.Host);
|
||||||
_files = await FileService.GetFilesAsync(Folder);
|
_files = await FileService.GetFilesAsync(Folder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleControlBase
|
@inherits ModuleControlBase
|
||||||
|
@using Microsoft.Extensions.Localization
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(HelpText))
|
@if (!string.IsNullOrEmpty(HelpText))
|
||||||
{
|
{
|
||||||
|
@ -26,6 +27,9 @@ else
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string HelpText { get; set; } // optional - tooltip for this label
|
public string HelpText { get; set; } // optional - tooltip for this label
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string ResourceKey { get; set; }
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
_openLabel = "<label";
|
_openLabel = "<label";
|
||||||
|
@ -40,5 +44,24 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
_openLabel += ">";
|
_openLabel += ">";
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(ResourceKey))
|
||||||
|
{
|
||||||
|
if (ModuleState?.ModuleType != null)
|
||||||
|
{
|
||||||
|
var moduleType = Type.GetType(ModuleState.ModuleType);
|
||||||
|
var localizerTypeName = $"Microsoft.Extensions.Localization.IStringLocalizer`1[[{moduleType.AssemblyQualifiedName}]], Microsoft.Extensions.Localization.Abstractions";
|
||||||
|
var localizerType = Type.GetType(localizerTypeName);
|
||||||
|
|
||||||
|
// HACK: Use ServiceActivator instead of injecting IHttpContextAccessor, because HttpContext throws NRE in WebAssembly runtime
|
||||||
|
using (var scope = ServiceActivator.GetScope())
|
||||||
|
{
|
||||||
|
var localizer = (IStringLocalizer)scope.ServiceProvider.GetService(localizerType);
|
||||||
|
|
||||||
|
ChildContent = @<text>@localizer[$"{ResourceKey}.Text"]</text>;
|
||||||
|
HelpText = localizer[$"{ResourceKey}.{nameof(HelpText)}"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{
|
{
|
||||||
<div class="@_classname" role="alert">
|
<div class="@_classname" role="alert">
|
||||||
@_message
|
@_message
|
||||||
@if (Type == MessageType.Error && UserSecurity.IsAuthorized(PageState.User, Constants.HostRole))
|
@if (Type == MessageType.Error && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||||
{
|
{
|
||||||
@((MarkupString)" ")<NavLink href="@NavigateUrl("admin/log")">View Details</NavLink>
|
@((MarkupString)" ")<NavLink href="@NavigateUrl("admin/log")">View Details</NavLink>
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,14 +103,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
_roles = await RoleService.GetRolesAsync(ModuleState.SiteId);
|
_roles = await RoleService.GetRolesAsync(ModuleState.SiteId);
|
||||||
_roles.Insert(0, new Role { Name = Constants.AllUsersRole });
|
_roles.Insert(0, new Role { Name = RoleNames.Everyone });
|
||||||
|
|
||||||
_permissions = new List<PermissionString>();
|
_permissions = new List<PermissionString>();
|
||||||
|
|
||||||
foreach (string permissionname in _permissionnames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (string permissionname in _permissionnames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
{
|
{
|
||||||
// initialize with admin role
|
// initialize with admin role
|
||||||
_permissions.Add(new PermissionString { PermissionName = permissionname, Permissions = Constants.AdminRole });
|
_permissions.Add(new PermissionString { PermissionName = permissionname, Permissions = RoleNames.Admin });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Permissions))
|
if (!string.IsNullOrEmpty(Permissions))
|
||||||
|
@ -161,7 +161,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool GetPermissionDisabled(string roleName)
|
private bool GetPermissionDisabled(string roleName)
|
||||||
=> roleName == Constants.AdminRole
|
=> roleName == RoleNames.Admin
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
|
@ -226,8 +226,8 @@
|
||||||
{
|
{
|
||||||
permission = _permissions[i];
|
permission = _permissions[i];
|
||||||
List<string> ids = permission.Permissions.Split(';').ToList();
|
List<string> ids = permission.Permissions.Split(';').ToList();
|
||||||
ids.Remove("!" + Constants.AllUsersRole); // remove deny all users
|
ids.Remove("!" + RoleNames.Everyone); // remove deny all users
|
||||||
ids.Remove("!" + Constants.RegisteredRole); // remove deny registered users
|
ids.Remove("!" + RoleNames.Registered); // remove deny registered users
|
||||||
permission.Permissions = string.Join(";", ids.ToArray());
|
permission.Permissions = string.Join(";", ids.ToArray());
|
||||||
_permissions[i] = permission;
|
_permissions[i] = permission;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,11 @@ namespace Oqtane.Client
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(x => x.ConfigureServices(builder.Services));
|
.ForEach(x => x.ConfigureServices(builder.Services));
|
||||||
}
|
}
|
||||||
|
var host = builder.Build();
|
||||||
|
|
||||||
await builder.Build().RunAsync();
|
ServiceActivator.Configure(host.Services);
|
||||||
|
|
||||||
|
await host.RunAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task LoadClientAssemblies(HttpClient http)
|
private static async Task LoadClientAssemblies(HttpClient http)
|
||||||
|
|
|
@ -173,13 +173,15 @@ namespace Oqtane.Services
|
||||||
// add entityid parameter to url for custom authorization policy
|
// add entityid parameter to url for custom authorization policy
|
||||||
public string CreateAuthorizationPolicyUrl(string url, int entityId)
|
public string CreateAuthorizationPolicyUrl(string url, int entityId)
|
||||||
{
|
{
|
||||||
|
string qs = "entityid=" + entityId.ToString();
|
||||||
|
|
||||||
if (url.Contains("?"))
|
if (url.Contains("?"))
|
||||||
{
|
{
|
||||||
return url + "&entityid=" + entityId.ToString();
|
return url + "&" + qs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return url + "?entityid=" + entityId.ToString();
|
return url + "?" + qs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="@BodyClass">
|
<div class="@BodyClass">
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole))
|
@if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
|
||||||
{
|
{
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@if (UserSecurity.GetPermissionStrings(PageState.Page.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(Constants.AllUsersRole))
|
@if (UserSecurity.GetPermissionStrings(PageState.Page.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(RoleNames.Everyone))
|
||||||
{
|
{
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("unpublish"))>Unpublish Page</button>
|
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("unpublish"))>Unpublish Page</button>
|
||||||
|
@ -510,8 +510,8 @@
|
||||||
if (permissionstring.PermissionName == PermissionNames.View)
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
{
|
{
|
||||||
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
if (!ids.Contains(Constants.AllUsersRole)) ids.Add(Constants.AllUsersRole);
|
if (!ids.Contains(RoleNames.Everyone)) ids.Add(RoleNames.Everyone);
|
||||||
if (!ids.Contains(Constants.RegisteredRole)) ids.Add(Constants.RegisteredRole);
|
if (!ids.Contains(RoleNames.Registered)) ids.Add(RoleNames.Registered);
|
||||||
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,12 +531,12 @@
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case "publish":
|
case "publish":
|
||||||
if (!ids.Contains(Constants.AllUsersRole)) ids.Add(Constants.AllUsersRole);
|
if (!ids.Contains(RoleNames.Everyone)) ids.Add(RoleNames.Everyone);
|
||||||
if (!ids.Contains(Constants.RegisteredRole)) ids.Add(Constants.RegisteredRole);
|
if (!ids.Contains(RoleNames.Registered)) ids.Add(RoleNames.Registered);
|
||||||
break;
|
break;
|
||||||
case "unpublish":
|
case "unpublish":
|
||||||
ids.Remove(Constants.AllUsersRole);
|
ids.Remove(RoleNames.Everyone);
|
||||||
ids.Remove(Constants.RegisteredRole);
|
ids.Remove(RoleNames.Registered);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Oqtane.Themes.Controls
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Icon = Icons.Cog, Name = "Manage Settings", Action = async (u, m) => await Settings(u, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.Cog, Name = "Manage Settings", Action = async (u, m) => await Settings(u, m)});
|
||||||
|
|
||||||
if (UserSecurity.GetPermissionStrings(ModuleState.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(Constants.AllUsersRole))
|
if (UserSecurity.GetPermissionStrings(ModuleState.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(RoleNames.Everyone))
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Icon=Icons.CircleX, Name = "Unpublish Module", Action = async (s, m) => await Unpublish(s, m) });
|
actionList.Add(new ActionViewModel {Icon=Icons.CircleX, Name = "Unpublish Module", Action = async (s, m) => await Unpublish(s, m) });
|
||||||
}
|
}
|
||||||
|
@ -141,8 +141,8 @@ namespace Oqtane.Themes.Controls
|
||||||
if (permissionstring.PermissionName == PermissionNames.View)
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
{
|
{
|
||||||
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
if (!ids.Contains(Constants.AllUsersRole)) ids.Add(Constants.AllUsersRole);
|
if (!ids.Contains(RoleNames.Everyone)) ids.Add(RoleNames.Everyone);
|
||||||
if (!ids.Contains(Constants.RegisteredRole)) ids.Add(Constants.RegisteredRole);
|
if (!ids.Contains(RoleNames.Registered)) ids.Add(RoleNames.Registered);
|
||||||
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ namespace Oqtane.Themes.Controls
|
||||||
if (permissionstring.PermissionName == PermissionNames.View)
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
{
|
{
|
||||||
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
ids.Remove(Constants.AllUsersRole);
|
ids.Remove(RoleNames.Everyone);
|
||||||
ids.Remove(Constants.RegisteredRole);
|
ids.Remove(RoleNames.Registered);
|
||||||
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
private string _databaseName = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm");
|
private string _databaseName = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm");
|
||||||
private string _username = string.Empty;
|
private string _username = string.Empty;
|
||||||
private string _password = string.Empty;
|
private string _password = string.Empty;
|
||||||
private string _hostUsername = Constants.HostUser;
|
private string _hostUsername = UserNames.Host;
|
||||||
private string _hostPassword = string.Empty;
|
private string _hostPassword = string.Empty;
|
||||||
private string _confirmPassword = string.Empty;
|
private string _confirmPassword = string.Empty;
|
||||||
private string _hostEmail = string.Empty;
|
private string _hostEmail = string.Empty;
|
||||||
|
@ -188,8 +188,8 @@
|
||||||
Aliases = uri.Authority,
|
Aliases = uri.Authority,
|
||||||
HostEmail = _hostEmail,
|
HostEmail = _hostEmail,
|
||||||
HostPassword = _hostPassword,
|
HostPassword = _hostPassword,
|
||||||
HostName = Constants.HostUser,
|
HostName = UserNames.Host,
|
||||||
TenantName = Constants.MasterTenant,
|
TenantName = TenantNames.Master,
|
||||||
IsNewTenant = true,
|
IsNewTenant = true,
|
||||||
SiteName = Constants.DefaultSite
|
SiteName = Constants.DefaultSite
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,7 +31,7 @@ else
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) && Name != Constants.AdminPane)
|
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) && Name != PaneNames.Admin)
|
||||||
{
|
{
|
||||||
_useadminborder = true;
|
_useadminborder = true;
|
||||||
_paneadminborder = "app-pane-admin-border";
|
_paneadminborder = "app-pane-admin-border";
|
||||||
|
@ -47,7 +47,7 @@ else
|
||||||
{
|
{
|
||||||
if (PageState.ModuleId != -1 && PageState.Action != Constants.DefaultAction)
|
if (PageState.ModuleId != -1 && PageState.Action != Constants.DefaultAction)
|
||||||
{
|
{
|
||||||
if (Name.ToLower() == Constants.AdminPane.ToLower())
|
if (Name.ToLower() == PaneNames.Admin.ToLower())
|
||||||
{
|
{
|
||||||
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
||||||
if (module != null && !module.IsDeleted)
|
if (module != null && !module.IsDeleted)
|
||||||
|
@ -81,10 +81,10 @@ else
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, module.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, module.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Host:
|
case SecurityAccessLevel.Host:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, RoleNames.Host);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,7 @@
|
||||||
// ensure module's pane exists in current page and if not, assign it to the Admin pane
|
// ensure module's pane exists in current page and if not, assign it to the Admin pane
|
||||||
if (page.Panes == null || page.Panes.FindIndex(item => item.Equals(module.Pane, StringComparison.OrdinalIgnoreCase)) == -1)
|
if (page.Panes == null || page.Panes.FindIndex(item => item.Equals(module.Pane, StringComparison.OrdinalIgnoreCase)) == -1)
|
||||||
{
|
{
|
||||||
module.Pane = Constants.AdminPane;
|
module.Pane = PaneNames.Admin;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate module position within pane
|
// calculate module position within pane
|
||||||
|
|
|
@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class AliasController : Controller
|
public class AliasController : Controller
|
||||||
{
|
{
|
||||||
private readonly IAliasRepository _aliases;
|
private readonly IAliasRepository _aliases;
|
||||||
|
@ -32,7 +32,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public IEnumerable<Alias> Get()
|
public IEnumerable<Alias> Get()
|
||||||
{
|
{
|
||||||
return _aliases.GetAliases();
|
return _aliases.GetAliases();
|
||||||
|
@ -40,7 +40,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Alias Get(int id)
|
public Alias Get(int id)
|
||||||
{
|
{
|
||||||
return _aliases.GetAlias(id);
|
return _aliases.GetAlias(id);
|
||||||
|
@ -86,7 +86,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Alias Post([FromBody] Alias alias)
|
public Alias Post([FromBody] Alias alias)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -99,7 +99,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Alias Put(int id, [FromBody] Alias alias)
|
public Alias Put(int id, [FromBody] Alias alias)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -112,7 +112,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_aliases.DeleteAlias(id);
|
_aliases.DeleteAlias(id);
|
||||||
|
|
|
@ -22,7 +22,7 @@ using Microsoft.AspNetCore.Routing.Constraints;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class FileController : Controller
|
public class FileController : Controller
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _environment;
|
private readonly IWebHostEnvironment _environment;
|
||||||
|
@ -58,7 +58,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (User.IsInRole(Constants.HostRole))
|
if (User.IsInRole(RoleNames.Host))
|
||||||
{
|
{
|
||||||
folder = GetFolderPath(folder);
|
folder = GetFolderPath(folder);
|
||||||
if (Directory.Exists(folder))
|
if (Directory.Exists(folder))
|
||||||
|
@ -132,7 +132,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Models.File Put(int id, [FromBody] Models.File file)
|
public Models.File Put(int id, [FromBody] Models.File file)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, file.FolderId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, file.FolderId, PermissionNames.Edit))
|
||||||
|
@ -164,7 +164,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Models.File file = _files.GetFile(id);
|
Models.File file = _files.GetFile(id);
|
||||||
|
@ -282,7 +282,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (User.IsInRole(Constants.HostRole))
|
if (User.IsInRole(RoleNames.Host))
|
||||||
{
|
{
|
||||||
folderPath = GetFolderPath(folder);
|
folderPath = GetFolderPath(folder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class FolderController : Controller
|
public class FolderController : Controller
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _environment;
|
private readonly IWebHostEnvironment _environment;
|
||||||
|
@ -93,7 +93,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Folder Post([FromBody] Folder folder)
|
public Folder Post([FromBody] Folder folder)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -106,7 +106,7 @@ namespace Oqtane.Controllers
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permissions = new List<Permission> {
|
permissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true),
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true),
|
||||||
}.EncodePermissions();
|
}.EncodePermissions();
|
||||||
}
|
}
|
||||||
if (_userPermissions.IsAuthorized(User, PermissionNames.Edit, permissions))
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Edit, permissions))
|
||||||
|
@ -141,7 +141,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Folder Put(int id, [FromBody] Folder folder)
|
public Folder Put(int id, [FromBody] Folder folder)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, folder.FolderId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, folder.FolderId, PermissionNames.Edit))
|
||||||
|
@ -182,7 +182,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/?siteid=x&folderid=y&parentid=z
|
// PUT api/<controller>/?siteid=x&folderid=y&parentid=z
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Put(int siteid, int folderid, int? parentid)
|
public void Put(int siteid, int folderid, int? parentid)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, folderid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, folderid, PermissionNames.Edit))
|
||||||
|
@ -209,7 +209,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, id, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, id, PermissionNames.Edit))
|
||||||
|
|
|
@ -14,7 +14,7 @@ using Oqtane.Themes;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class InstallationController : Controller
|
public class InstallationController : Controller
|
||||||
{
|
{
|
||||||
private readonly IConfigurationRoot _config;
|
private readonly IConfigurationRoot _config;
|
||||||
|
@ -36,7 +36,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
var installation = new Installation {Success = false, Message = ""};
|
var installation = new Installation {Success = false, Message = ""};
|
||||||
|
|
||||||
if (ModelState.IsValid && (User.IsInRole(Constants.HostRole) || string.IsNullOrEmpty(_config.GetConnectionString(SettingKeys.ConnectionStringKey))))
|
if (ModelState.IsValid && (User.IsInRole(RoleNames.Host) || string.IsNullOrEmpty(_config.GetConnectionString(SettingKeys.ConnectionStringKey))))
|
||||||
{
|
{
|
||||||
installation = _databaseManager.Install(config);
|
installation = _databaseManager.Install(config);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("upgrade")]
|
[HttpGet("upgrade")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Installation Upgrade()
|
public Installation Upgrade()
|
||||||
{
|
{
|
||||||
var installation = new Installation {Success = true, Message = ""};
|
var installation = new Installation {Success = true, Message = ""};
|
||||||
|
@ -149,7 +149,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
zipfile = memoryStream.ToArray();
|
zipfile = memoryStream.ToArray();
|
||||||
}
|
}
|
||||||
return File(zipfile, "application/octet-stream", "oqtane.zip");
|
return File(zipfile, System.Net.Mime.MediaTypeNames.Application.Octet, "oqtane.zip");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class JobController : Controller
|
public class JobController : Controller
|
||||||
{
|
{
|
||||||
private readonly IJobRepository _jobs;
|
private readonly IJobRepository _jobs;
|
||||||
|
@ -28,7 +28,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public IEnumerable<Job> Get()
|
public IEnumerable<Job> Get()
|
||||||
{
|
{
|
||||||
return _jobs.GetJobs();
|
return _jobs.GetJobs();
|
||||||
|
@ -36,7 +36,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Job Get(int id)
|
public Job Get(int id)
|
||||||
{
|
{
|
||||||
return _jobs.GetJob(id);
|
return _jobs.GetJob(id);
|
||||||
|
@ -44,7 +44,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Job Post([FromBody] Job job)
|
public Job Post([FromBody] Job job)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -57,7 +57,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Job Put(int id, [FromBody] Job job)
|
public Job Put(int id, [FromBody] Job job)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -70,7 +70,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_jobs.DeleteJob(id);
|
_jobs.DeleteJob(id);
|
||||||
|
@ -79,7 +79,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/start
|
// GET api/<controller>/start
|
||||||
[HttpGet("start/{id}")]
|
[HttpGet("start/{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Start(int id)
|
public void Start(int id)
|
||||||
{
|
{
|
||||||
Job job = _jobs.GetJob(id);
|
Job job = _jobs.GetJob(id);
|
||||||
|
@ -93,7 +93,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/stop
|
// GET api/<controller>/stop
|
||||||
[HttpGet("stop/{id}")]
|
[HttpGet("stop/{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Stop(int id)
|
public void Stop(int id)
|
||||||
{
|
{
|
||||||
Job job = _jobs.GetJob(id);
|
Job job = _jobs.GetJob(id);
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class JobLogController : Controller
|
public class JobLogController : Controller
|
||||||
{
|
{
|
||||||
private readonly IJobLogRepository _jobLogs;
|
private readonly IJobLogRepository _jobLogs;
|
||||||
|
@ -23,7 +23,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public IEnumerable<JobLog> Get()
|
public IEnumerable<JobLog> Get()
|
||||||
{
|
{
|
||||||
return _jobLogs.GetJobLogs();
|
return _jobLogs.GetJobLogs();
|
||||||
|
@ -31,7 +31,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public JobLog Get(int id)
|
public JobLog Get(int id)
|
||||||
{
|
{
|
||||||
return _jobLogs.GetJobLog(id);
|
return _jobLogs.GetJobLog(id);
|
||||||
|
@ -39,7 +39,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public JobLog Post([FromBody] JobLog jobLog)
|
public JobLog Post([FromBody] JobLog jobLog)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -52,7 +52,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public JobLog Put(int id, [FromBody] JobLog jobLog)
|
public JobLog Put(int id, [FromBody] JobLog jobLog)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -65,7 +65,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_jobLogs.DeleteJobLog(id);
|
_jobLogs.DeleteJobLog(id);
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Oqtane.Shared;
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class LogController : Controller
|
public class LogController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
|
@ -23,7 +23,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?siteid=x&level=y&function=z&rows=50
|
// GET: api/<controller>?siteid=x&level=y&function=z&rows=50
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public IEnumerable<Log> Get(string siteid, string level, string function, string rows)
|
public IEnumerable<Log> Get(string siteid, string level, string function, string rows)
|
||||||
{
|
{
|
||||||
return _logs.GetLogs(int.Parse(siteid), level, function, int.Parse(rows));
|
return _logs.GetLogs(int.Parse(siteid), level, function, int.Parse(rows));
|
||||||
|
@ -31,7 +31,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Log Get(int id)
|
public Log Get(int id)
|
||||||
{
|
{
|
||||||
return _logs.GetLog(id);
|
return _logs.GetLog(id);
|
||||||
|
|
|
@ -11,7 +11,7 @@ using Oqtane.Security;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class ModuleController : Controller
|
public class ModuleController : Controller
|
||||||
{
|
{
|
||||||
private readonly IModuleRepository _modules;
|
private readonly IModuleRepository _modules;
|
||||||
|
@ -89,7 +89,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Module Post([FromBody] Module module)
|
public Module Post([FromBody] Module module)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, module.PageId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, module.PageId, PermissionNames.Edit))
|
||||||
|
@ -108,7 +108,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Module Put(int id, [FromBody] Module module)
|
public Module Put(int id, [FromBody] Module module)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, module.ModuleId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, module.ModuleId, PermissionNames.Edit))
|
||||||
|
@ -140,7 +140,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, EntityNames.Module, id, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Module, id, PermissionNames.Edit))
|
||||||
|
@ -157,7 +157,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/export?moduleid=x
|
// GET api/<controller>/export?moduleid=x
|
||||||
[HttpGet("export")]
|
[HttpGet("export")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public string Export(int moduleid)
|
public string Export(int moduleid)
|
||||||
{
|
{
|
||||||
string content = "";
|
string content = "";
|
||||||
|
@ -175,7 +175,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>/import?moduleid=x
|
// POST api/<controller>/import?moduleid=x
|
||||||
[HttpPost("import")]
|
[HttpPost("import")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public bool Import(int moduleid, [FromBody] string content)
|
public bool Import(int moduleid, [FromBody] string content)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
|
@ -19,7 +19,7 @@ using System.Text.Json;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class ModuleDefinitionController : Controller
|
public class ModuleDefinitionController : Controller
|
||||||
{
|
{
|
||||||
private readonly IModuleDefinitionRepository _moduleDefinitions;
|
private readonly IModuleDefinitionRepository _moduleDefinitions;
|
||||||
|
@ -81,7 +81,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public void Put(int id, [FromBody] ModuleDefinition moduleDefinition)
|
public void Put(int id, [FromBody] ModuleDefinition moduleDefinition)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -92,7 +92,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("install")]
|
[HttpGet("install")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void InstallModules()
|
public void InstallModules()
|
||||||
{
|
{
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Modules Installed");
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Modules Installed");
|
||||||
|
@ -101,7 +101,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5?siteid=x
|
// DELETE api/<controller>/5?siteid=x
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Delete(int id, int siteid)
|
public void Delete(int id, int siteid)
|
||||||
{
|
{
|
||||||
ModuleDefinition moduledefinition = _moduleDefinitions.GetModuleDefinition(id, siteid);
|
ModuleDefinition moduledefinition = _moduleDefinitions.GetModuleDefinition(id, siteid);
|
||||||
|
@ -168,7 +168,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>?moduleid=x
|
// POST api/<controller>?moduleid=x
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Post([FromBody] ModuleDefinition moduleDefinition, string moduleid)
|
public void Post([FromBody] ModuleDefinition moduleDefinition, string moduleid)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Oqtane.Security;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class NotificationController : Controller
|
public class NotificationController : Controller
|
||||||
{
|
{
|
||||||
private readonly INotificationRepository _notifications;
|
private readonly INotificationRepository _notifications;
|
||||||
|
@ -26,7 +26,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?siteid=x&type=y&userid=z
|
// GET: api/<controller>?siteid=x&type=y&userid=z
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public IEnumerable<Notification> Get(string siteid, string direction, string userid)
|
public IEnumerable<Notification> Get(string siteid, string direction, string userid)
|
||||||
{
|
{
|
||||||
IEnumerable<Notification> notifications = null;
|
IEnumerable<Notification> notifications = null;
|
||||||
|
@ -46,7 +46,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Notification Get(int id)
|
public Notification Get(int id)
|
||||||
{
|
{
|
||||||
Notification notification = _notifications.GetNotification(id);
|
Notification notification = _notifications.GetNotification(id);
|
||||||
|
@ -59,7 +59,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Notification Post([FromBody] Notification notification)
|
public Notification Post([FromBody] Notification notification)
|
||||||
{
|
{
|
||||||
if (IsAuthorized(notification.FromUserId))
|
if (IsAuthorized(notification.FromUserId))
|
||||||
|
@ -72,7 +72,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Notification Put(int id, [FromBody] Notification notification)
|
public Notification Put(int id, [FromBody] Notification notification)
|
||||||
{
|
{
|
||||||
if (IsAuthorized(notification.FromUserId))
|
if (IsAuthorized(notification.FromUserId))
|
||||||
|
@ -85,7 +85,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Notification notification = _notifications.GetNotification(id);
|
Notification notification = _notifications.GetNotification(id);
|
||||||
|
|
|
@ -15,7 +15,7 @@ using Oqtane.Shared;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class PackageController : Controller
|
public class PackageController : Controller
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _environment;
|
private readonly IWebHostEnvironment _environment;
|
||||||
|
@ -27,7 +27,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?tag=x
|
// GET: api/<controller>?tag=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public async Task<IEnumerable<Package>> Get(string tag)
|
public async Task<IEnumerable<Package>> Get(string tag)
|
||||||
{
|
{
|
||||||
List<Package> packages = new List<Package>();
|
List<Package> packages = new List<Package>();
|
||||||
|
@ -55,7 +55,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public async Task Post(string packageid, string version, string folder)
|
public async Task Post(string packageid, string version, string folder)
|
||||||
{
|
{
|
||||||
using (var httpClient = new HttpClient())
|
using (var httpClient = new HttpClient())
|
||||||
|
|
|
@ -13,7 +13,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class PageController : Controller
|
public class PageController : Controller
|
||||||
{
|
{
|
||||||
private readonly IPageRepository _pages;
|
private readonly IPageRepository _pages;
|
||||||
|
@ -102,7 +102,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Page Post([FromBody] Page page)
|
public Page Post([FromBody] Page page)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -115,7 +115,7 @@ namespace Oqtane.Controllers
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permissions = new List<Permission> {
|
permissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions();
|
}.EncodePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>/5?userid=x
|
// POST api/<controller>/5?userid=x
|
||||||
[HttpPost("{id}")]
|
[HttpPost("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Page Post(int id, string userid)
|
public Page Post(int id, string userid)
|
||||||
{
|
{
|
||||||
Page page = null;
|
Page page = null;
|
||||||
|
@ -213,7 +213,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Page Put(int id, [FromBody] Page page)
|
public Page Put(int id, [FromBody] Page page)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, page.PageId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, page.PageId, PermissionNames.Edit))
|
||||||
|
@ -233,7 +233,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/?siteid=x&pageid=y&parentid=z
|
// PUT api/<controller>/?siteid=x&pageid=y&parentid=z
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Put(int siteid, int pageid, int? parentid)
|
public void Put(int siteid, int pageid, int? parentid)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
||||||
|
@ -261,7 +261,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Page page = _pages.GetPage(id);
|
Page page = _pages.GetPage(id);
|
||||||
|
|
|
@ -11,7 +11,7 @@ using Oqtane.Security;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class PageModuleController : Controller
|
public class PageModuleController : Controller
|
||||||
{
|
{
|
||||||
private readonly IPageModuleRepository _pageModules;
|
private readonly IPageModuleRepository _pageModules;
|
||||||
|
@ -65,7 +65,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public PageModule Post([FromBody] PageModule pageModule)
|
public PageModule Post([FromBody] PageModule pageModule)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, pageModule.PageId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, pageModule.PageId, PermissionNames.Edit))
|
||||||
|
@ -85,7 +85,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public PageModule Put(int id, [FromBody] PageModule pageModule)
|
public PageModule Put(int id, [FromBody] PageModule pageModule)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, pageModule.ModuleId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, pageModule.ModuleId, PermissionNames.Edit))
|
||||||
|
@ -105,7 +105,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/?pageid=x&pane=y
|
// PUT api/<controller>/?pageid=x&pane=y
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Put(int pageid, string pane)
|
public void Put(int pageid, string pane)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
||||||
|
@ -133,7 +133,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
PageModule pagemodule = _pageModules.GetPageModule(id);
|
PageModule pagemodule = _pageModules.GetPageModule(id);
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class ProfileController : Controller
|
public class ProfileController : Controller
|
||||||
{
|
{
|
||||||
private readonly IProfileRepository _profiles;
|
private readonly IProfileRepository _profiles;
|
||||||
|
@ -37,7 +37,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Profile Post([FromBody] Profile profile)
|
public Profile Post([FromBody] Profile profile)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -50,7 +50,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Profile Put(int id, [FromBody] Profile profile)
|
public Profile Put(int id, [FromBody] Profile profile)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -63,7 +63,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_profiles.DeleteProfile(id);
|
_profiles.DeleteProfile(id);
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class RoleController : Controller
|
public class RoleController : Controller
|
||||||
{
|
{
|
||||||
private readonly IRoleRepository _roles;
|
private readonly IRoleRepository _roles;
|
||||||
|
@ -23,7 +23,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?siteid=x
|
// GET: api/<controller>?siteid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public IEnumerable<Role> Get(string siteid)
|
public IEnumerable<Role> Get(string siteid)
|
||||||
{
|
{
|
||||||
return _roles.GetRoles(int.Parse(siteid));
|
return _roles.GetRoles(int.Parse(siteid));
|
||||||
|
@ -31,7 +31,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public Role Get(int id)
|
public Role Get(int id)
|
||||||
{
|
{
|
||||||
return _roles.GetRole(id);
|
return _roles.GetRole(id);
|
||||||
|
@ -39,7 +39,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Role Post([FromBody] Role role)
|
public Role Post([FromBody] Role role)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -52,7 +52,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Role Put(int id, [FromBody] Role role)
|
public Role Put(int id, [FromBody] Role role)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -65,7 +65,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_roles.DeleteRole(id);
|
_roles.DeleteRole(id);
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class SettingController : Controller
|
public class SettingController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISettingRepository _settings;
|
private readonly ISettingRepository _settings;
|
||||||
|
@ -124,10 +124,10 @@ namespace Oqtane.Controllers
|
||||||
switch (entityName)
|
switch (entityName)
|
||||||
{
|
{
|
||||||
case EntityNames.Tenant:
|
case EntityNames.Tenant:
|
||||||
authorized = User.IsInRole(Constants.HostRole);
|
authorized = User.IsInRole(RoleNames.Host);
|
||||||
break;
|
break;
|
||||||
case EntityNames.Site:
|
case EntityNames.Site:
|
||||||
authorized = User.IsInRole(Constants.AdminRole);
|
authorized = User.IsInRole(RoleNames.Admin);
|
||||||
break;
|
break;
|
||||||
case EntityNames.Page:
|
case EntityNames.Page:
|
||||||
case EntityNames.Module:
|
case EntityNames.Module:
|
||||||
|
@ -138,7 +138,7 @@ namespace Oqtane.Controllers
|
||||||
authorized = true;
|
authorized = true;
|
||||||
if (permissionName == PermissionNames.Edit)
|
if (permissionName == PermissionNames.Edit)
|
||||||
{
|
{
|
||||||
authorized = User.IsInRole(Constants.AdminRole) || (_userPermissions.GetUser(User).UserId == entityId);
|
authorized = User.IsInRole(RoleNames.Admin) || (_userPermissions.GetUser(User).UserId == entityId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class SiteController : Controller
|
public class SiteController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISiteRepository _sites;
|
private readonly ISiteRepository _sites;
|
||||||
|
@ -28,7 +28,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public IEnumerable<Site> Get()
|
public IEnumerable<Site> Get()
|
||||||
{
|
{
|
||||||
return _sites.GetSites();
|
return _sites.GetSites();
|
||||||
|
@ -57,7 +57,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
authorized = User.IsInRole(Constants.HostRole);
|
authorized = User.IsInRole(RoleNames.Host);
|
||||||
}
|
}
|
||||||
if (authorized)
|
if (authorized)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Site Put(int id, [FromBody] Site site)
|
public Site Put(int id, [FromBody] Site site)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -84,7 +84,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_sites.DeleteSite(id);
|
_sites.DeleteSite(id);
|
||||||
|
|
|
@ -7,7 +7,7 @@ using Oqtane.Shared;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class SiteTemplateController : Controller
|
public class SiteTemplateController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISiteTemplateRepository _siteTemplates;
|
private readonly ISiteTemplateRepository _siteTemplates;
|
||||||
|
@ -19,7 +19,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public IEnumerable<SiteTemplate> Get()
|
public IEnumerable<SiteTemplate> Get()
|
||||||
{
|
{
|
||||||
return _siteTemplates.GetSiteTemplates();
|
return _siteTemplates.GetSiteTemplates();
|
||||||
|
|
|
@ -14,7 +14,7 @@ using System;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class SqlController : Controller
|
public class SqlController : Controller
|
||||||
{
|
{
|
||||||
private readonly ITenantRepository _tenants;
|
private readonly ITenantRepository _tenants;
|
||||||
|
@ -30,7 +30,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST: api/<controller>
|
// POST: api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public SqlQuery Post([FromBody] SqlQuery sqlquery)
|
public SqlQuery Post([FromBody] SqlQuery sqlquery)
|
||||||
{
|
{
|
||||||
var results = new List<Dictionary<string, string>>();
|
var results = new List<Dictionary<string, string>>();
|
||||||
|
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class SystemController : Controller
|
public class SystemController : Controller
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _environment;
|
private readonly IWebHostEnvironment _environment;
|
||||||
|
@ -19,7 +19,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Dictionary<string, string> Get()
|
public Dictionary<string, string> Get()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> systeminfo = new Dictionary<string, string>();
|
Dictionary<string, string> systeminfo = new Dictionary<string, string>();
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class TenantController : Controller
|
public class TenantController : Controller
|
||||||
{
|
{
|
||||||
private readonly ITenantRepository _tenants;
|
private readonly ITenantRepository _tenants;
|
||||||
|
@ -23,7 +23,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public IEnumerable<Tenant> Get()
|
public IEnumerable<Tenant> Get()
|
||||||
{
|
{
|
||||||
return _tenants.GetTenants();
|
return _tenants.GetTenants();
|
||||||
|
@ -31,7 +31,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public Tenant Get(int id)
|
public Tenant Get(int id)
|
||||||
{
|
{
|
||||||
return _tenants.GetTenant(id);
|
return _tenants.GetTenant(id);
|
||||||
|
@ -39,7 +39,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Tenant Post([FromBody] Tenant tenant)
|
public Tenant Post([FromBody] Tenant tenant)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -52,7 +52,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public Tenant Put(int id, [FromBody] Tenant tenant)
|
public Tenant Put(int id, [FromBody] Tenant tenant)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -65,7 +65,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_tenants.DeleteTenant(id);
|
_tenants.DeleteTenant(id);
|
||||||
|
|
|
@ -16,7 +16,7 @@ using System.Text.Json;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class ThemeController : Controller
|
public class ThemeController : Controller
|
||||||
{
|
{
|
||||||
private readonly IThemeRepository _themes;
|
private readonly IThemeRepository _themes;
|
||||||
|
@ -34,14 +34,14 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public IEnumerable<Theme> Get()
|
public IEnumerable<Theme> Get()
|
||||||
{
|
{
|
||||||
return _themes.GetThemes();
|
return _themes.GetThemes();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("install")]
|
[HttpGet("install")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void InstallThemes()
|
public void InstallThemes()
|
||||||
{
|
{
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Themes Installed");
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Themes Installed");
|
||||||
|
@ -50,7 +50,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/xxx
|
// DELETE api/<controller>/xxx
|
||||||
[HttpDelete("{themename}")]
|
[HttpDelete("{themename}")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = RoleNames.Host)]
|
||||||
public void Delete(string themename)
|
public void Delete(string themename)
|
||||||
{
|
{
|
||||||
List<Theme> themes = _themes.GetThemes().ToList();
|
List<Theme> themes = _themes.GetThemes().ToList();
|
||||||
|
|
|
@ -18,7 +18,7 @@ using Oqtane.Extensions;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class UserController : Controller
|
public class UserController : Controller
|
||||||
{
|
{
|
||||||
private readonly IUserRepository _users;
|
private readonly IUserRepository _users;
|
||||||
|
@ -77,7 +77,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
private User Filter(User user)
|
private User Filter(User user)
|
||||||
{
|
{
|
||||||
if (user != null && !User.IsInRole(Constants.AdminRole) && User.Identity.Name?.ToLower() != user.Username.ToLower())
|
if (user != null && !User.IsInRole(RoleNames.Admin) && User.Identity.Name?.ToLower() != user.Username.ToLower())
|
||||||
{
|
{
|
||||||
user.DisplayName = "";
|
user.DisplayName = "";
|
||||||
user.Email = "";
|
user.Email = "";
|
||||||
|
@ -118,7 +118,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
bool verified;
|
bool verified;
|
||||||
bool allowregistration;
|
bool allowregistration;
|
||||||
if (user.Username == Constants.HostUser || User.IsInRole(Constants.AdminRole))
|
if (user.Username == UserNames.Host || User.IsInRole(RoleNames.Admin))
|
||||||
{
|
{
|
||||||
verified = true;
|
verified = true;
|
||||||
allowregistration = true;
|
allowregistration = true;
|
||||||
|
@ -164,9 +164,9 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign to host role if this is the host user ( initial installation )
|
// assign to host role if this is the host user ( initial installation )
|
||||||
if (user.Username == Constants.HostUser)
|
if (user.Username == UserNames.Host)
|
||||||
{
|
{
|
||||||
int hostroleid = _roles.GetRoles(user.SiteId, true).Where(item => item.Name == Constants.HostRole).FirstOrDefault().RoleId;
|
int hostroleid = _roles.GetRoles(user.SiteId, true).Where(item => item.Name == RoleNames.Host).FirstOrDefault().RoleId;
|
||||||
UserRole userrole = new UserRole();
|
UserRole userrole = new UserRole();
|
||||||
userrole.UserId = newUser.UserId;
|
userrole.UserId = newUser.UserId;
|
||||||
userrole.RoleId = hostroleid;
|
userrole.RoleId = hostroleid;
|
||||||
|
@ -190,7 +190,7 @@ namespace Oqtane.Controllers
|
||||||
Permissions = new List<Permission>
|
Permissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.Browse, newUser.UserId, true),
|
new Permission(PermissionNames.Browse, newUser.UserId, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, newUser.UserId, true)
|
new Permission(PermissionNames.Edit, newUser.UserId, true)
|
||||||
}.EncodePermissions()
|
}.EncodePermissions()
|
||||||
});
|
});
|
||||||
|
@ -206,7 +206,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newUser != null && user.Username != Constants.HostUser)
|
if (newUser != null && user.Username != UserNames.Host)
|
||||||
{
|
{
|
||||||
// add auto assigned roles to user for site
|
// add auto assigned roles to user for site
|
||||||
List<Role> roles = _roles.GetRoles(user.SiteId).Where(item => item.IsAutoAssigned).ToList();
|
List<Role> roles = _roles.GetRoles(user.SiteId).Where(item => item.IsAutoAssigned).ToList();
|
||||||
|
@ -242,7 +242,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
if (User.IsInRole(Constants.AdminRole) || User.Identity.Name == user.Username)
|
if (User.IsInRole(RoleNames.Admin) || User.Identity.Name == user.Username)
|
||||||
{
|
{
|
||||||
if (user.Password != "")
|
if (user.Password != "")
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5?siteid=x
|
// DELETE api/<controller>/5?siteid=x
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public async Task Delete(int id)
|
public async Task Delete(int id)
|
||||||
{
|
{
|
||||||
IdentityUser identityuser = await _identityUserManager.FindByNameAsync(_users.GetUser(id).Username);
|
IdentityUser identityuser = await _identityUserManager.FindByNameAsync(_users.GetUser(id).Username);
|
||||||
|
@ -460,9 +460,9 @@ namespace Oqtane.Controllers
|
||||||
foreach (UserRole userrole in userroles)
|
foreach (UserRole userrole in userroles)
|
||||||
{
|
{
|
||||||
roles += userrole.Role.Name + ";";
|
roles += userrole.Role.Name + ";";
|
||||||
if (userrole.Role.Name == Constants.HostRole && userroles.Where(item => item.Role.Name == Constants.AdminRole).FirstOrDefault() == null)
|
if (userrole.Role.Name == RoleNames.Host && userroles.Where(item => item.Role.Name == RoleNames.Admin).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
roles += Constants.AdminRole + ";";
|
roles += RoleNames.Admin + ";";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (roles != "") roles = ";" + roles;
|
if (roles != "") roles = ";" + roles;
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Oqtane.Repository;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class UserRoleController : Controller
|
public class UserRoleController : Controller
|
||||||
{
|
{
|
||||||
private readonly IUserRoleRepository _userRoles;
|
private readonly IUserRoleRepository _userRoles;
|
||||||
|
@ -27,7 +27,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?siteid=x
|
// GET: api/<controller>?siteid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public IEnumerable<UserRole> Get(string siteid)
|
public IEnumerable<UserRole> Get(string siteid)
|
||||||
{
|
{
|
||||||
return _userRoles.GetUserRoles(int.Parse(siteid));
|
return _userRoles.GetUserRoles(int.Parse(siteid));
|
||||||
|
@ -35,7 +35,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public UserRole Get(int id)
|
public UserRole Get(int id)
|
||||||
{
|
{
|
||||||
return _userRoles.GetUserRole(id);
|
return _userRoles.GetUserRole(id);
|
||||||
|
@ -43,7 +43,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public UserRole Post([FromBody] UserRole userRole)
|
public UserRole Post([FromBody] UserRole userRole)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -57,7 +57,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public UserRole Put(int id, [FromBody] UserRole userRole)
|
public UserRole Put(int id, [FromBody] UserRole userRole)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
@ -71,7 +71,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
UserRole userRole = _userRoles.GetUserRole(id);
|
UserRole userRole = _userRoles.GetUserRole(id);
|
||||||
|
|
21
Oqtane.Server/Extensions/WebHostBuilderExtensions.cs
Normal file
21
Oqtane.Server/Extensions/WebHostBuilderExtensions.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Oqtane.Infrastructure;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Hosting
|
||||||
|
{
|
||||||
|
public static class WebHostBuilderExtensions
|
||||||
|
{
|
||||||
|
public static IWebHostBuilder ConfigureLocalizationSettings(this IWebHostBuilder builder)
|
||||||
|
{
|
||||||
|
return builder.ConfigureServices((context, services) =>
|
||||||
|
{
|
||||||
|
var config = context.Configuration;
|
||||||
|
|
||||||
|
services.Configure<LocalizationOptions>(config.GetSection("Localization"));
|
||||||
|
services.AddSingleton(ctx => ctx.GetService<IOptions<LocalizationOptions>>().Value);
|
||||||
|
services.AddTransient<ILocalizationManager, LocalizationManager>();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -72,7 +72,7 @@ namespace Oqtane.Infrastructure
|
||||||
if (install == null)
|
if (install == null)
|
||||||
{
|
{
|
||||||
// startup or silent installation
|
// startup or silent installation
|
||||||
install = new InstallConfig { ConnectionString = _config.GetConnectionString(SettingKeys.ConnectionStringKey), TenantName = Constants.MasterTenant, IsNewTenant = false };
|
install = new InstallConfig { ConnectionString = _config.GetConnectionString(SettingKeys.ConnectionStringKey), TenantName = TenantNames.Master, IsNewTenant = false };
|
||||||
|
|
||||||
if (!IsInstalled())
|
if (!IsInstalled())
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ namespace Oqtane.Infrastructure
|
||||||
if (!string.IsNullOrEmpty(install.ConnectionString) && !string.IsNullOrEmpty(install.Aliases) && !string.IsNullOrEmpty(install.HostPassword) && !string.IsNullOrEmpty(install.HostEmail))
|
if (!string.IsNullOrEmpty(install.ConnectionString) && !string.IsNullOrEmpty(install.Aliases) && !string.IsNullOrEmpty(install.HostPassword) && !string.IsNullOrEmpty(install.HostEmail))
|
||||||
{
|
{
|
||||||
// silent install
|
// silent install
|
||||||
install.HostName = Constants.HostUser;
|
install.HostName = UserNames.Host;
|
||||||
install.SiteTemplate = GetInstallationConfig(SettingKeys.SiteTemplateKey, Constants.DefaultSiteTemplate);
|
install.SiteTemplate = GetInstallationConfig(SettingKeys.SiteTemplateKey, Constants.DefaultSiteTemplate);
|
||||||
install.DefaultTheme = GetInstallationConfig(SettingKeys.DefaultThemeKey, Constants.DefaultTheme);
|
install.DefaultTheme = GetInstallationConfig(SettingKeys.DefaultThemeKey, Constants.DefaultTheme);
|
||||||
install.DefaultLayout = GetInstallationConfig(SettingKeys.DefaultLayoutKey, Constants.DefaultLayout);
|
install.DefaultLayout = GetInstallationConfig(SettingKeys.DefaultLayoutKey, Constants.DefaultLayout);
|
||||||
|
@ -192,7 +192,7 @@ namespace Oqtane.Infrastructure
|
||||||
{
|
{
|
||||||
var result = new Installation { Success = false, Message = string.Empty };
|
var result = new Installation { Success = false, Message = string.Empty };
|
||||||
|
|
||||||
if (install.TenantName == Constants.MasterTenant)
|
if (install.TenantName == TenantNames.Master)
|
||||||
{
|
{
|
||||||
MigrateScriptNamingConvention("Master", install.ConnectionString);
|
MigrateScriptNamingConvention("Master", install.ConnectionString);
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ namespace Oqtane.Infrastructure
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
_cache.Remove("tenants");
|
_cache.Remove("tenants");
|
||||||
|
|
||||||
if (install.TenantName == Constants.MasterTenant)
|
if (install.TenantName == TenantNames.Master)
|
||||||
{
|
{
|
||||||
var job = new Job { Name = "Notification Job", JobType = "Oqtane.Infrastructure.NotificationJob, Oqtane.Server", Frequency = "m", Interval = 1, StartDate = null, EndDate = null, IsEnabled = false, IsStarted = false, IsExecuting = false, NextExecution = null, RetentionHistory = 10, CreatedBy = "", CreatedOn = DateTime.UtcNow, ModifiedBy = "", ModifiedOn = DateTime.UtcNow };
|
var job = new Job { Name = "Notification Job", JobType = "Oqtane.Infrastructure.NotificationJob, Oqtane.Server", Frequency = "m", Interval = 1, StartDate = null, EndDate = null, IsEnabled = false, IsStarted = false, IsExecuting = false, NextExecution = null, RetentionHistory = 10, CreatedBy = "", CreatedOn = DateTime.UtcNow, ModifiedBy = "", ModifiedOn = DateTime.UtcNow };
|
||||||
db.Job.Add(job);
|
db.Job.Add(job);
|
||||||
|
@ -350,7 +350,7 @@ namespace Oqtane.Infrastructure
|
||||||
foreach (var tenant in db.Tenant.ToList())
|
foreach (var tenant in db.Tenant.ToList())
|
||||||
{
|
{
|
||||||
int index = Array.FindIndex(versions, item => item == moduledefinition.Version);
|
int index = Array.FindIndex(versions, item => item == moduledefinition.Version);
|
||||||
if (tenant.Name == install.TenantName && install.TenantName != Constants.MasterTenant)
|
if (tenant.Name == install.TenantName && install.TenantName != TenantNames.Master)
|
||||||
{
|
{
|
||||||
index = -1;
|
index = -1;
|
||||||
}
|
}
|
||||||
|
@ -439,17 +439,17 @@ namespace Oqtane.Infrastructure
|
||||||
};
|
};
|
||||||
site = sites.AddSite(site);
|
site = sites.AddSite(site);
|
||||||
|
|
||||||
IdentityUser identityUser = identityUserManager.FindByNameAsync(Constants.HostUser).GetAwaiter().GetResult();
|
IdentityUser identityUser = identityUserManager.FindByNameAsync(UserNames.Host).GetAwaiter().GetResult();
|
||||||
if (identityUser == null)
|
if (identityUser == null)
|
||||||
{
|
{
|
||||||
identityUser = new IdentityUser { UserName = Constants.HostUser, Email = install.HostEmail, EmailConfirmed = true };
|
identityUser = new IdentityUser { UserName = UserNames.Host, Email = install.HostEmail, EmailConfirmed = true };
|
||||||
var create = identityUserManager.CreateAsync(identityUser, install.HostPassword).GetAwaiter().GetResult();
|
var create = identityUserManager.CreateAsync(identityUser, install.HostPassword).GetAwaiter().GetResult();
|
||||||
if (create.Succeeded)
|
if (create.Succeeded)
|
||||||
{
|
{
|
||||||
var user = new User
|
var user = new User
|
||||||
{
|
{
|
||||||
SiteId = site.SiteId,
|
SiteId = site.SiteId,
|
||||||
Username = Constants.HostUser,
|
Username = UserNames.Host,
|
||||||
Password = install.HostPassword,
|
Password = install.HostPassword,
|
||||||
Email = install.HostEmail,
|
Email = install.HostEmail,
|
||||||
DisplayName = install.HostName,
|
DisplayName = install.HostName,
|
||||||
|
@ -458,7 +458,7 @@ namespace Oqtane.Infrastructure
|
||||||
};
|
};
|
||||||
|
|
||||||
user = users.AddUser(user);
|
user = users.AddUser(user);
|
||||||
var hostRoleId = roles.GetRoles(user.SiteId, true).FirstOrDefault(item => item.Name == Constants.HostRole)?.RoleId ?? 0;
|
var hostRoleId = roles.GetRoles(user.SiteId, true).FirstOrDefault(item => item.Name == RoleNames.Host)?.RoleId ?? 0;
|
||||||
var userRole = new UserRole { UserId = user.UserId, RoleId = hostRoleId, EffectiveDate = null, ExpiryDate = null };
|
var userRole = new UserRole { UserId = user.UserId, RoleId = hostRoleId, EffectiveDate = null, ExpiryDate = null };
|
||||||
userroles.AddUserRole(userRole);
|
userroles.AddUserRole(userRole);
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ namespace Oqtane.Infrastructure
|
||||||
Permissions = new List<Permission>
|
Permissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.Browse, user.UserId, true),
|
new Permission(PermissionNames.Browse, user.UserId, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, user.UserId, true),
|
new Permission(PermissionNames.Edit, user.UserId, true),
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,16 +43,16 @@ namespace Oqtane.SiteTemplates
|
||||||
IsNavigation = true,
|
IsNavigation = true,
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission> {
|
PagePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions() ,
|
}.EncodePermissions() ,
|
||||||
PageTemplateModules = new List<PageTemplateModule> {
|
PageTemplateModules = new List<PageTemplateModule> {
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Welcome To Oqtane...", Pane = "Content",
|
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Welcome To Oqtane...", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission> {
|
ModulePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = "<p><a href=\"https://www.oqtane.org\" target=\"_new\">Oqtane</a> is an open source <b>modular application framework</b> that provides advanced functionality for developing web and mobile applications on ASP.NET Core. It leverages the revolutionary new Blazor component model to compose a <b>fully dynamic</b> web development experience which can be hosted either client-side or server-side. Whether you are looking for a platform to <b>accelerate your web development</b> efforts, or simply interested in exploring the anatomy of a large-scale Blazor application, Oqtane provides a solid foundation based on proven enterprise architectural principles.</p>" +
|
Content = "<p><a href=\"https://www.oqtane.org\" target=\"_new\">Oqtane</a> is an open source <b>modular application framework</b> that provides advanced functionality for developing web and mobile applications on ASP.NET Core. It leverages the revolutionary new Blazor component model to compose a <b>fully dynamic</b> web development experience which can be hosted either client-side or server-side. Whether you are looking for a platform to <b>accelerate your web development</b> efforts, or simply interested in exploring the anatomy of a large-scale Blazor application, Oqtane provides a solid foundation based on proven enterprise architectural principles.</p>" +
|
||||||
"<p align=\"center\"><a href=\"https://www.oqtane.org\" target=\"_new\"><img class=\"img-fluid\" src=\"oqtane-white.png\"></a></p><p align=\"center\"><a class=\"btn btn-primary\" href=\"https://www.oqtane.org/Community\" target=\"_new\">Join Our Community</a> <a class=\"btn btn-primary\" href=\"https://github.com/oqtane/oqtane.framework\" target=\"_new\">Clone Our Repo</a></p>" +
|
"<p align=\"center\"><a href=\"https://www.oqtane.org\" target=\"_new\"><img class=\"img-fluid\" src=\"oqtane-white.png\"></a></p><p align=\"center\"><a class=\"btn btn-primary\" href=\"https://www.oqtane.org/Community\" target=\"_new\">Join Our Community</a> <a class=\"btn btn-primary\" href=\"https://github.com/oqtane/oqtane.framework\" target=\"_new\">Clone Our Repo</a></p>" +
|
||||||
|
@ -61,9 +61,9 @@ namespace Oqtane.SiteTemplates
|
||||||
},
|
},
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "MIT License", Pane = "Content",
|
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "MIT License", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission> {
|
ModulePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = "<p>Copyright (c) 2019-2020 .NET Foundation</p>" +
|
Content = "<p>Copyright (c) 2019-2020 .NET Foundation</p>" +
|
||||||
"<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>" +
|
"<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>" +
|
||||||
|
@ -72,9 +72,9 @@ namespace Oqtane.SiteTemplates
|
||||||
},
|
},
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Secure Content", Pane = "Content",
|
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Secure Content", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission> {
|
ModulePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.RegisteredRole, true),
|
new Permission(PermissionNames.View, RoleNames.Registered, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = "<p>Oqtane allows you to control access to your content using security roles. This module is only visible to Registered Users of the site.</p>"
|
Content = "<p>Oqtane allows you to control access to your content using security roles. This module is only visible to Registered Users of the site.</p>"
|
||||||
}
|
}
|
||||||
|
@ -89,16 +89,16 @@ namespace Oqtane.SiteTemplates
|
||||||
IsNavigation = true,
|
IsNavigation = true,
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission> {
|
PagePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.RegisteredRole, true),
|
new Permission(PermissionNames.View, RoleNames.Registered, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule> {
|
PageTemplateModules = new List<PageTemplateModule> {
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Secure Content", Pane = "Content",
|
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Secure Content", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission> {
|
ModulePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.RegisteredRole, true),
|
new Permission(PermissionNames.View, RoleNames.Registered, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = "<p>Oqtane allows you to control access to your content using security roles. This page is only visible to Registered Users of the site.</p>"
|
Content = "<p>Oqtane allows you to control access to your content using security roles. This page is only visible to Registered Users of the site.</p>"
|
||||||
}
|
}
|
||||||
|
@ -113,16 +113,16 @@ namespace Oqtane.SiteTemplates
|
||||||
IsNavigation = true,
|
IsNavigation = true,
|
||||||
IsPersonalizable = true,
|
IsPersonalizable = true,
|
||||||
PagePermissions = new List<Permission> {
|
PagePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule> {
|
PageTemplateModules = new List<PageTemplateModule> {
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "My Page", Pane = "Content",
|
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "My Page", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission> {
|
ModulePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = "<p>Oqtane offers native support for user personalized pages. If a page is identified as personalizable by the site administrator in the page settings, when an authenticated user visits the page they will see an edit button at the top right corner of the page next to their username. When they click this button the sytem will create a new version of the page and allow them to edit the page content.</p>"
|
Content = "<p>Oqtane offers native support for user personalized pages. If a page is identified as personalizable by the site administrator in the page settings, when an authenticated user visits the page they will see an edit button at the top right corner of the page next to their username. When they click this button the sytem will create a new version of the page and allow them to edit the page content.</p>"
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ namespace Oqtane.SiteTemplates
|
||||||
IsNavigation = true,
|
IsNavigation = true,
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission> {
|
PagePermissions = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>()
|
PageTemplateModules = new List<PageTemplateModule>()
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,9 +40,9 @@ namespace Oqtane.Infrastructure
|
||||||
// EditMode = false,
|
// EditMode = false,
|
||||||
// PagePermissions = new List<Permission>
|
// PagePermissions = new List<Permission>
|
||||||
// {
|
// {
|
||||||
// new Permission(PermissionNames.View, Constants.AdminRole, true),
|
// new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
// new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
// new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
// new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
// new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
// }.EncodePermissions(),
|
// }.EncodePermissions(),
|
||||||
// PageTemplateModules = new List<PageTemplateModule>
|
// PageTemplateModules = new List<PageTemplateModule>
|
||||||
// {
|
// {
|
||||||
|
@ -51,9 +51,9 @@ namespace Oqtane.Infrastructure
|
||||||
// ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Login.Index).ToModuleDefinitionName(), Title = "Test", Pane = "Content",
|
// ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Login.Index).ToModuleDefinitionName(), Title = "Test", Pane = "Content",
|
||||||
// ModulePermissions = new List<Permission>
|
// ModulePermissions = new List<Permission>
|
||||||
// {
|
// {
|
||||||
// new Permission(PermissionNames.View, Constants.AdminRole, true),
|
// new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
// new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
// new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
// new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
// new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
// }.EncodePermissions(),
|
// }.EncodePermissions(),
|
||||||
// Content = ""
|
// Content = ""
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -12,7 +12,7 @@ using Oqtane.Controllers;
|
||||||
|
|
||||||
namespace Oqtane.Modules.HtmlText.Controllers
|
namespace Oqtane.Modules.HtmlText.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class HtmlTextController : ModuleControllerBase
|
public class HtmlTextController : ModuleControllerBase
|
||||||
{
|
{
|
||||||
private readonly IHtmlTextRepository _htmlText;
|
private readonly IHtmlTextRepository _htmlText;
|
||||||
|
@ -24,7 +24,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = PolicyNames.ViewModule)]
|
||||||
public List<HtmlTextInfo> Get(int id)
|
public List<HtmlTextInfo> Get(int id)
|
||||||
{
|
{
|
||||||
var list = new List<HtmlTextInfo>();
|
var list = new List<HtmlTextInfo>();
|
||||||
|
@ -47,7 +47,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public HtmlTextInfo Post([FromBody] HtmlTextInfo htmlText)
|
public HtmlTextInfo Post([FromBody] HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -68,7 +68,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public HtmlTextInfo Put(int id, [FromBody] HtmlTextInfo htmlText)
|
public HtmlTextInfo Put(int id, [FromBody] HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -89,7 +89,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace Oqtane.Server
|
||||||
.AddCommandLine(args)
|
.AddCommandLine(args)
|
||||||
.Build())
|
.Build())
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
|
.ConfigureLocalizationSettings()
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,15 +239,15 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
moduledefinition.Permissions = new List<Permission>
|
moduledefinition.Permissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.Utilize, Constants.AdminRole, true)
|
new Permission(PermissionNames.Utilize, RoleNames.Admin, true)
|
||||||
}.EncodePermissions();
|
}.EncodePermissions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moduledefinition.Permissions = new List<Permission>
|
moduledefinition.Permissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.Utilize, Constants.AdminRole, true),
|
new Permission(PermissionNames.Utilize, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Utilize, Constants.RegisteredRole, true)
|
new Permission(PermissionNames.Utilize, RoleNames.Registered, true)
|
||||||
}.EncodePermissions();
|
}.EncodePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,9 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -71,9 +71,9 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Login.Index).ToModuleDefinitionName(), Title = "User Login", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Login.Index).ToModuleDefinitionName(), Title = "User Login", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,9 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -100,9 +100,9 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Register.Index).ToModuleDefinitionName(), Title = "User Registration", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Register.Index).ToModuleDefinitionName(), Title = "User Registration", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -119,9 +119,9 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -130,9 +130,9 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Reset.Index).ToModuleDefinitionName(), Title = "Password Reset", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Reset.Index).ToModuleDefinitionName(), Title = "Password Reset", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.RegisteredRole, true),
|
new Permission(PermissionNames.View, RoleNames.Registered, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -159,9 +159,9 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.UserProfile.Index).ToModuleDefinitionName(), Title = "User Profile", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.UserProfile.Index).ToModuleDefinitionName(), Title = "User Profile", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.RegisteredRole, true),
|
new Permission(PermissionNames.View, RoleNames.Registered, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -174,8 +174,8 @@ namespace Oqtane.Repository
|
||||||
Name = "Admin", Parent = "", Path = "admin", Icon = "", IsNavigation = false, IsPersonalizable = false,
|
Name = "Admin", Parent = "", Path = "admin", Icon = "", IsNavigation = false, IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -184,8 +184,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Dashboard.Index).ToModuleDefinitionName(), Title = "Admin Dashboard", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Dashboard.Index).ToModuleDefinitionName(), Title = "Admin Dashboard", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -211,8 +211,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Site.Index).ToModuleDefinitionName(), Title = "Site Settings", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Site.Index).ToModuleDefinitionName(), Title = "Site Settings", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -238,8 +238,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Pages.Index).ToModuleDefinitionName(), Title = "Page Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Pages.Index).ToModuleDefinitionName(), Title = "Page Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -265,8 +265,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Users.Index).ToModuleDefinitionName(), Title = "User Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Users.Index).ToModuleDefinitionName(), Title = "User Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -282,8 +282,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -292,8 +292,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Profiles.Index).ToModuleDefinitionName(), Title = "Profile Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Profiles.Index).ToModuleDefinitionName(), Title = "Profile Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -309,8 +309,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -319,8 +319,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Roles.Index).ToModuleDefinitionName(), Title = "Role Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Roles.Index).ToModuleDefinitionName(), Title = "Role Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -336,8 +336,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -346,8 +346,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Files.Index).ToModuleDefinitionName(), Title = "File Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Files.Index).ToModuleDefinitionName(), Title = "File Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -363,8 +363,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -373,8 +373,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.RecycleBin.Index).ToModuleDefinitionName(), Title = "Recycle Bin", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.RecycleBin.Index).ToModuleDefinitionName(), Title = "Recycle Bin", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -392,8 +392,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -402,8 +402,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Logs.Index).ToModuleDefinitionName(), Title = "Event Log", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Logs.Index).ToModuleDefinitionName(), Title = "Event Log", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -418,8 +418,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -428,8 +428,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Tenants.Index).ToModuleDefinitionName(), Title = "Tenant Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Tenants.Index).ToModuleDefinitionName(), Title = "Tenant Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -440,8 +440,8 @@ namespace Oqtane.Repository
|
||||||
Name = "Site Management", Parent = "Admin", Path = "admin/sites", Icon = Icons.Globe, IsNavigation = false, IsPersonalizable = false,
|
Name = "Site Management", Parent = "Admin", Path = "admin/sites", Icon = Icons.Globe, IsNavigation = false, IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -450,8 +450,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sites.Index).ToModuleDefinitionName(), Title = "Site Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sites.Index).ToModuleDefinitionName(), Title = "Site Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -462,8 +462,8 @@ namespace Oqtane.Repository
|
||||||
Name = "Module Management", Parent = "Admin", Path = "admin/modules", Icon = Icons.Browser, IsNavigation = false, IsPersonalizable = false,
|
Name = "Module Management", Parent = "Admin", Path = "admin/modules", Icon = Icons.Browser, IsNavigation = false, IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -472,8 +472,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.ModuleDefinitions.Index).ToModuleDefinitionName(), Title = "Module Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.ModuleDefinitions.Index).ToModuleDefinitionName(), Title = "Module Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -484,8 +484,8 @@ namespace Oqtane.Repository
|
||||||
Name = "Theme Management", Parent = "Admin", Path = "admin/themes", Icon = Icons.Brush, IsNavigation = false, IsPersonalizable = false,
|
Name = "Theme Management", Parent = "Admin", Path = "admin/themes", Icon = Icons.Brush, IsNavigation = false, IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -494,8 +494,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Themes.Index).ToModuleDefinitionName(), Title = "Theme Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Themes.Index).ToModuleDefinitionName(), Title = "Theme Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -506,8 +506,8 @@ namespace Oqtane.Repository
|
||||||
Name = "Scheduled Jobs", Parent = "Admin", Path = "admin/jobs", Icon = Icons.Timer, IsNavigation = false, IsPersonalizable = false,
|
Name = "Scheduled Jobs", Parent = "Admin", Path = "admin/jobs", Icon = Icons.Timer, IsNavigation = false, IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -516,8 +516,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Jobs.Index).ToModuleDefinitionName(), Title = "Scheduled Jobs", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Jobs.Index).ToModuleDefinitionName(), Title = "Scheduled Jobs", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -533,8 +533,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -543,8 +543,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sql.Index).ToModuleDefinitionName(), Title = "Sql Management", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sql.Index).ToModuleDefinitionName(), Title = "Sql Management", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -560,8 +560,8 @@ namespace Oqtane.Repository
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -570,8 +570,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.SystemInfo.Index).ToModuleDefinitionName(), Title = "System Info", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.SystemInfo.Index).ToModuleDefinitionName(), Title = "System Info", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -582,8 +582,8 @@ namespace Oqtane.Repository
|
||||||
Name = "System Update", Parent = "Admin", Path = "admin/update", Icon = Icons.Aperture, IsNavigation = false, IsPersonalizable = false,
|
Name = "System Update", Parent = "Admin", Path = "admin/update", Icon = Icons.Aperture, IsNavigation = false, IsPersonalizable = false,
|
||||||
PagePermissions = new List<Permission>
|
PagePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
{
|
{
|
||||||
|
@ -592,8 +592,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Upgrade.Index).ToModuleDefinitionName(), Title = "System Update", Pane = "Content",
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Upgrade.Index).ToModuleDefinitionName(), Title = "System Update", Pane = "Content",
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, Constants.HostRole, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.HostRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
||||||
}.EncodePermissions(),
|
}.EncodePermissions(),
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
|
@ -640,18 +640,18 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
// create default entities for site
|
// create default entities for site
|
||||||
List<Role> roles = _roleRepository.GetRoles(site.SiteId, true).ToList();
|
List<Role> roles = _roleRepository.GetRoles(site.SiteId, true).ToList();
|
||||||
if (!roles.Where(item => item.Name == Constants.AllUsersRole).Any())
|
if (!roles.Where(item => item.Name == RoleNames.Everyone).Any())
|
||||||
{
|
{
|
||||||
_roleRepository.AddRole(new Role {SiteId = null, Name = Constants.AllUsersRole, Description = "All Users", IsAutoAssigned = false, IsSystem = true});
|
_roleRepository.AddRole(new Role {SiteId = null, Name = RoleNames.Everyone, Description = "All Users", IsAutoAssigned = false, IsSystem = true});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!roles.Where(item => item.Name == Constants.HostRole).Any())
|
if (!roles.Where(item => item.Name == RoleNames.Host).Any())
|
||||||
{
|
{
|
||||||
_roleRepository.AddRole(new Role {SiteId = null, Name = Constants.HostRole, Description = "Application Administrators", IsAutoAssigned = false, IsSystem = true});
|
_roleRepository.AddRole(new Role {SiteId = null, Name = RoleNames.Host, Description = "Application Administrators", IsAutoAssigned = false, IsSystem = true});
|
||||||
}
|
}
|
||||||
|
|
||||||
_roleRepository.AddRole(new Role {SiteId = site.SiteId, Name = Constants.RegisteredRole, Description = "Registered Users", IsAutoAssigned = true, IsSystem = true});
|
_roleRepository.AddRole(new Role {SiteId = site.SiteId, Name = RoleNames.Registered, Description = "Registered Users", IsAutoAssigned = true, IsSystem = true});
|
||||||
_roleRepository.AddRole(new Role {SiteId = site.SiteId, Name = Constants.AdminRole, Description = "Site Administrators", IsAutoAssigned = false, IsSystem = true});
|
_roleRepository.AddRole(new Role {SiteId = site.SiteId, Name = RoleNames.Admin, Description = "Site Administrators", IsAutoAssigned = false, IsSystem = true});
|
||||||
|
|
||||||
_profileRepository.AddProfile(new Profile
|
_profileRepository.AddProfile(new Profile
|
||||||
{SiteId = site.SiteId, Name = "FirstName", Title = "First Name", Description = "Your First Or Given Name", Category = "Name", ViewOrder = 1, MaxLength = 50, DefaultValue = "", IsRequired = true, IsPrivate = false});
|
{SiteId = site.SiteId, Name = "FirstName", Title = "First Name", Description = "Your First Or Given Name", Category = "Name", ViewOrder = 1, MaxLength = 50, DefaultValue = "", IsRequired = true, IsPrivate = false});
|
||||||
|
@ -675,9 +675,9 @@ namespace Oqtane.Repository
|
||||||
SiteId = site.SiteId, ParentId = null, Name = "Root", Path = "", Order = 1, IsSystem = true,
|
SiteId = site.SiteId, ParentId = null, Name = "Root", Path = "", Order = 1, IsSystem = true,
|
||||||
Permissions = new List<Permission>
|
Permissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.Browse, Constants.AdminRole, true),
|
new Permission(PermissionNames.Browse, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions()
|
}.EncodePermissions()
|
||||||
});
|
});
|
||||||
_folderRepository.AddFolder(new Folder
|
_folderRepository.AddFolder(new Folder
|
||||||
|
@ -685,9 +685,9 @@ namespace Oqtane.Repository
|
||||||
SiteId = site.SiteId, ParentId = folder.FolderId, Name = "Users", Path = Utilities.PathCombine("Users",Path.DirectorySeparatorChar.ToString()), Order = 1, IsSystem = true,
|
SiteId = site.SiteId, ParentId = folder.FolderId, Name = "Users", Path = Utilities.PathCombine("Users",Path.DirectorySeparatorChar.ToString()), Order = 1, IsSystem = true,
|
||||||
Permissions = new List<Permission>
|
Permissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.Browse, Constants.AdminRole, true),
|
new Permission(PermissionNames.Browse, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
}.EncodePermissions()
|
}.EncodePermissions()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
var oldTenant =_db.Tenant.AsNoTracking().FirstOrDefault(t=> t.TenantId == tenant.TenantId);
|
var oldTenant =_db.Tenant.AsNoTracking().FirstOrDefault(t=> t.TenantId == tenant.TenantId);
|
||||||
|
|
||||||
if (oldTenant != null && (oldTenant.Name.Equals(Constants.MasterTenant, StringComparison.OrdinalIgnoreCase) && !oldTenant.Name.Equals(tenant.Name)))
|
if (oldTenant != null && (oldTenant.Name.Equals(TenantNames.Master, StringComparison.OrdinalIgnoreCase) && !oldTenant.Name.Equals(tenant.Name)))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to rename the master tenant.");
|
throw new InvalidOperationException("Unable to rename the master tenant.");
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace Oqtane.Repository
|
||||||
public void DeleteTenant(int tenantId)
|
public void DeleteTenant(int tenantId)
|
||||||
{
|
{
|
||||||
var tenant = GetTenant(tenantId);
|
var tenant = GetTenant(tenantId);
|
||||||
if (tenant != null && !tenant.Name.Equals(Constants.MasterTenant, StringComparison.OrdinalIgnoreCase))
|
if (tenant != null && !tenant.Name.Equals(TenantNames.Master, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
_db.Tenant.Remove(tenant);
|
_db.Tenant.Remove(tenant);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
|
|
|
@ -39,15 +39,15 @@ namespace Oqtane.Security
|
||||||
{
|
{
|
||||||
id.AddClaim(new Claim(_options.ClaimsIdentity.RoleClaimType, userrole.Role.Name));
|
id.AddClaim(new Claim(_options.ClaimsIdentity.RoleClaimType, userrole.Role.Name));
|
||||||
// host users are members of every site
|
// host users are members of every site
|
||||||
if (userrole.Role.Name == Constants.HostRole)
|
if (userrole.Role.Name == RoleNames.Host)
|
||||||
{
|
{
|
||||||
if (userroles.Where(item => item.Role.Name == Constants.RegisteredRole).FirstOrDefault() == null)
|
if (userroles.Where(item => item.Role.Name == RoleNames.Registered).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
id.AddClaim(new Claim(_options.ClaimsIdentity.RoleClaimType, Constants.RegisteredRole));
|
id.AddClaim(new Claim(_options.ClaimsIdentity.RoleClaimType, RoleNames.Registered));
|
||||||
}
|
}
|
||||||
if (userroles.Where(item => item.Role.Name == Constants.AdminRole).FirstOrDefault() == null)
|
if (userroles.Where(item => item.Role.Name == RoleNames.Admin).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
id.AddClaim(new Claim(_options.ClaimsIdentity.RoleClaimType, Constants.AdminRole));
|
id.AddClaim(new Claim(_options.ClaimsIdentity.RoleClaimType, RoleNames.Admin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,21 +27,23 @@ namespace Oqtane
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
private static readonly string[] DefaultSupportedCultures = new[] { Constants.DefaultCulture };
|
|
||||||
|
|
||||||
private string _webRoot;
|
private string _webRoot;
|
||||||
private Runtime _runtime;
|
private Runtime _runtime;
|
||||||
private bool _useSwagger;
|
private bool _useSwagger;
|
||||||
|
private IWebHostEnvironment _env;
|
||||||
|
private string[] _supportedCultures;
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; }
|
public IConfigurationRoot Configuration { get; }
|
||||||
|
|
||||||
public Startup(IWebHostEnvironment env)
|
public Startup(IWebHostEnvironment env, ILocalizationManager localizationManager)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(env.ContentRootPath)
|
.SetBasePath(env.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
|
|
||||||
|
_supportedCultures = localizationManager.GetSupportedCultures();
|
||||||
|
|
||||||
_runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server;
|
_runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server;
|
||||||
|
|
||||||
//add possibility to switch off swagger on production.
|
//add possibility to switch off swagger on production.
|
||||||
|
@ -49,6 +51,8 @@ namespace Oqtane
|
||||||
|
|
||||||
_webRoot = env.WebRootPath;
|
_webRoot = env.WebRootPath;
|
||||||
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data"));
|
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data"));
|
||||||
|
|
||||||
|
_env = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
@ -58,7 +62,13 @@ namespace Oqtane
|
||||||
// Register localization services
|
// Register localization services
|
||||||
services.AddLocalization(options => options.ResourcesPath = "Resources");
|
services.AddLocalization(options => options.ResourcesPath = "Resources");
|
||||||
|
|
||||||
services.AddServerSideBlazor();
|
services.AddServerSideBlazor().AddCircuitOptions(options =>
|
||||||
|
{
|
||||||
|
if (_env.IsDevelopment())
|
||||||
|
{
|
||||||
|
options.DetailedErrors = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// setup HttpClient for server side in a client side compatible fashion ( with auth cookie )
|
// setup HttpClient for server side in a client side compatible fashion ( with auth cookie )
|
||||||
if (!services.Any(x => x.ServiceType == typeof(HttpClient)))
|
if (!services.Any(x => x.ServiceType == typeof(HttpClient)))
|
||||||
|
@ -132,11 +142,6 @@ namespace Oqtane
|
||||||
.AddSignInManager()
|
.AddSignInManager()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
var localizationSection = Configuration.GetSection("Localization");
|
|
||||||
var localizationOptions = localizationSection.Get<LocalizationOptions>();
|
|
||||||
|
|
||||||
services.Configure<LocalizationOptions>(localizationSection);
|
|
||||||
|
|
||||||
services.Configure<IdentityOptions>(options =>
|
services.Configure<IdentityOptions>(options =>
|
||||||
{
|
{
|
||||||
// Password settings
|
// Password settings
|
||||||
|
@ -210,10 +215,7 @@ namespace Oqtane
|
||||||
services.AddTransient<IUpgradeManager, UpgradeManager>();
|
services.AddTransient<IUpgradeManager, UpgradeManager>();
|
||||||
|
|
||||||
// load the external assemblies into the app domain, install services
|
// load the external assemblies into the app domain, install services
|
||||||
services.AddOqtane(_runtime,
|
services.AddOqtane(_runtime, _supportedCultures);
|
||||||
localizationOptions.SupportedCultures.IsNullOrEmpty()
|
|
||||||
? DefaultSupportedCultures
|
|
||||||
: localizationOptions.SupportedCultures);
|
|
||||||
|
|
||||||
services.AddMvc()
|
services.AddMvc()
|
||||||
.AddNewtonsoftJson()
|
.AddNewtonsoftJson()
|
||||||
|
@ -229,6 +231,8 @@ namespace Oqtane
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
|
ServiceActivator.Configure(app.ApplicationServices);
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
[ServerReference]
|
<ServerReference />
|
||||||
[SharedReference]
|
<SharedReference />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -10,7 +10,7 @@ using [Owner].[Module].Repository;
|
||||||
|
|
||||||
namespace [Owner].[Module].Controllers
|
namespace [Owner].[Module].Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route(ControllerRoutes.Default)]
|
||||||
public class [Module]Controller : Controller
|
public class [Module]Controller : Controller
|
||||||
{
|
{
|
||||||
private readonly I[Module]Repository _[Module]Repository;
|
private readonly I[Module]Repository _[Module]Repository;
|
||||||
|
@ -30,7 +30,7 @@ namespace [Owner].[Module].Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?moduleid=x
|
// GET: api/<controller>?moduleid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = PolicyNames.ViewModule)]
|
||||||
public IEnumerable<Models.[Module]> Get(string moduleid)
|
public IEnumerable<Models.[Module]> Get(string moduleid)
|
||||||
{
|
{
|
||||||
return _[Module]Repository.Get[Module]s(int.Parse(moduleid));
|
return _[Module]Repository.Get[Module]s(int.Parse(moduleid));
|
||||||
|
@ -38,7 +38,7 @@ namespace [Owner].[Module].Controllers
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = PolicyNames.ViewModule)]
|
||||||
public Models.[Module] Get(int id)
|
public Models.[Module] Get(int id)
|
||||||
{
|
{
|
||||||
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
||||||
|
@ -51,7 +51,7 @@ namespace [Owner].[Module].Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public Models.[Module] Post([FromBody] Models.[Module] [Module])
|
public Models.[Module] Post([FromBody] Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
||||||
|
@ -64,7 +64,7 @@ namespace [Owner].[Module].Controllers
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module])
|
public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
||||||
|
@ -77,7 +77,7 @@ namespace [Owner].[Module].Controllers
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
// DELETE api/<controller>/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
||||||
|
|
28
Oqtane.Shared/Documentation/InternalApi.cs
Normal file
28
Oqtane.Shared/Documentation/InternalApi.cs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Oqtane.Documentation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This attribute serves as metadata for other things to mark them as internal APIs.
|
||||||
|
/// Use this on stuff you want to document publicly, but mark as internal so people are warned
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
|
||||||
|
[PublicApi]
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
public class InternalApi_DoNotUse_MayChangeWithoutNotice: Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The `[InternalApi_DoNotUse_MayChangeWithoutNotice]` attribute can be used without additional comment.
|
||||||
|
/// </summary>
|
||||||
|
// Important note - this constructor looks unnecessary, because comment is optional in the other constructor
|
||||||
|
// but we need it because of a minor issue in docfx
|
||||||
|
public InternalApi_DoNotUse_MayChangeWithoutNotice() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor with optional comment `[InternalApi_DoNotUse_MayChangeWithoutNotice(some-comment)]`.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comment">Reason why it's internal, optional</param>
|
||||||
|
public InternalApi_DoNotUse_MayChangeWithoutNotice(string comment) { }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
27
Oqtane.Shared/Documentation/PrivateApi.cs
Normal file
27
Oqtane.Shared/Documentation/PrivateApi.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Oqtane.Documentation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This attribute marks classes, methods, etc. as private APIs
|
||||||
|
/// So they should _not_ be publicly documented.
|
||||||
|
/// By default, all APIs are private, so you only need this attribute on children of classes marked with `[PublicApi]`.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
|
||||||
|
[PublicApi]
|
||||||
|
public class PrivateApi: Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The `[PrivateApi]` attribute can be used without additional comment.
|
||||||
|
/// </summary>
|
||||||
|
// Important note - this constructor looks unnecessary, because comment could be optional in the other constructor
|
||||||
|
// but we need it because of a minor issue in docfx
|
||||||
|
public PrivateApi() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor with optional comment `[PrivateApi(some-comment)]`.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comment">Reason why it's private, optional</param>
|
||||||
|
public PrivateApi(string comment) { }
|
||||||
|
}
|
||||||
|
}
|
27
Oqtane.Shared/Documentation/PublicApi.cs
Normal file
27
Oqtane.Shared/Documentation/PublicApi.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Oqtane.Documentation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This attribute marks classes, properties etc. as public APIs.
|
||||||
|
/// Any API / code with this attribute will be published in the docs.
|
||||||
|
/// You can apply it to anything, but usually you will only need it on classes.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
|
||||||
|
[PublicApi]
|
||||||
|
public class PublicApi: Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The `[PublicApi]` attribute can usually be used without additional comment.
|
||||||
|
/// </summary>
|
||||||
|
// Important note - this constructor looks unnecessary, because comment could be optional in the other constructor
|
||||||
|
// but we need it because of a minor issue in docfx
|
||||||
|
public PublicApi() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor with optional comment `[PublicApi(some-comment)]`
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comment">Reason why it's public, optional</param>
|
||||||
|
public PublicApi(string comment) { }
|
||||||
|
}
|
||||||
|
}
|
18
Oqtane.Shared/Documentation/WorkInProgressApi.cs
Normal file
18
Oqtane.Shared/Documentation/WorkInProgressApi.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Oqtane.Documentation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This attribute marks APIs to be publicly documented with a clear warning that it's work in progress.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
|
||||||
|
[PublicApi]
|
||||||
|
public class WorkInProgressApi: Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The `[WorkInProgressApi(some-comment)]` attributes must always have a comment why they are WIP.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comment">Reason why it's WIP, required</param>
|
||||||
|
public WorkInProgressApi(string comment) { }
|
||||||
|
}
|
||||||
|
}
|
7
Oqtane.Shared/Documentation/readme.md
Normal file
7
Oqtane.Shared/Documentation/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Oqtane API Decorator Attributes
|
||||||
|
|
||||||
|
This folder contains special attributes for the API Code Generator.
|
||||||
|
|
||||||
|
The idea is that only items marked with special attributes are valide public APIs, and only these will be documented in the public docs
|
||||||
|
|
||||||
|
As of 2020, all APIs are documented, and only these marked as `[PrivateApi]` will be excluded. In future, we may reverse this to only document things marked as `[PublicApi]`.
|
|
@ -85,14 +85,14 @@ namespace Oqtane.Security
|
||||||
if (permission.StartsWith("!"))
|
if (permission.StartsWith("!"))
|
||||||
{
|
{
|
||||||
string denyRole = permission.Replace("!", "");
|
string denyRole = permission.Replace("!", "");
|
||||||
if (denyRole == Constants.AllUsersRole || IsAllowed(userId, roles, denyRole))
|
if (denyRole == RoleNames.Everyone || IsAllowed(userId, roles, denyRole))
|
||||||
{
|
{
|
||||||
allowed = false;
|
allowed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // grant permission
|
else // grant permission
|
||||||
{
|
{
|
||||||
if (permission == Constants.AllUsersRole || IsAllowed(userId, roles, permission))
|
if (permission == RoleNames.Everyone || IsAllowed(userId, roles, permission))
|
||||||
{
|
{
|
||||||
allowed = true;
|
allowed = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Oqtane.Shared
|
namespace Oqtane.Shared {
|
||||||
{
|
|
||||||
public class Constants
|
public class Constants {
|
||||||
{
|
|
||||||
public const string PackageId = "Oqtane.Framework";
|
public const string PackageId = "Oqtane.Framework";
|
||||||
public const string Version = "1.0.4";
|
public const string Version = "1.0.4";
|
||||||
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4";
|
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4";
|
||||||
|
@ -19,7 +18,9 @@ namespace Oqtane.Shared
|
||||||
|
|
||||||
public const string ActionToken = "{Action}";
|
public const string ActionToken = "{Action}";
|
||||||
public const string DefaultAction = "Index";
|
public const string DefaultAction = "Index";
|
||||||
public const string AdminPane = "Admin";
|
|
||||||
|
[Obsolete("Use PaneNames.Admin")]
|
||||||
|
public const string AdminPane = PaneNames.Admin;
|
||||||
public const string ModuleDelimiter = "*";
|
public const string ModuleDelimiter = "*";
|
||||||
public const string UrlParametersDelimiter = "!";
|
public const string UrlParametersDelimiter = "!";
|
||||||
|
|
||||||
|
@ -36,15 +37,23 @@ namespace Oqtane.Shared
|
||||||
|
|
||||||
public const string ContentUrl = "/api/file/download/";
|
public const string ContentUrl = "/api/file/download/";
|
||||||
|
|
||||||
public const string HostUser = "host";
|
[Obsolete("Use UserNames.Host instead.")]
|
||||||
|
public const string HostUser = UserNames.Host;
|
||||||
|
|
||||||
public const string MasterTenant = "Master";
|
[Obsolete("Use TenantNames.Master instead")]
|
||||||
|
public const string MasterTenant = TenantNames.Master;
|
||||||
public const string DefaultSite = "Default Site";
|
public const string DefaultSite = "Default Site";
|
||||||
|
|
||||||
public const string AllUsersRole = "All Users";
|
const string RoleObsoleteMessage = "Use the corresponding memeber from Oqtane.Shared.RoleNames";
|
||||||
public const string HostRole = "Host Users";
|
|
||||||
public const string AdminRole = "Administrators";
|
[Obsolete(RoleObsoleteMessage)]
|
||||||
public const string RegisteredRole = "Registered Users";
|
public const string AllUsersRole = RoleNames.Everyone;
|
||||||
|
[Obsolete(RoleObsoleteMessage)]
|
||||||
|
public const string HostRole = RoleNames.Host;
|
||||||
|
[Obsolete(RoleObsoleteMessage)]
|
||||||
|
public const string AdminRole = RoleNames.Admin;
|
||||||
|
[Obsolete(RoleObsoleteMessage)]
|
||||||
|
public const string RegisteredRole = RoleNames.Registered;
|
||||||
|
|
||||||
public const string ImageFiles = "jpg,jpeg,jpe,gif,bmp,png,svg,ico";
|
public const string ImageFiles = "jpg,jpeg,jpe,gif,bmp,png,svg,ico";
|
||||||
public const string UploadableFiles = "jpg,jpeg,jpe,gif,bmp,png,svg,ico,mov,wmv,avi,mp4,mp3,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,nupkg,csv";
|
public const string UploadableFiles = "jpg,jpeg,jpe,gif,bmp,png,svg,ico,mov,wmv,avi,mp4,mp3,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,nupkg,csv";
|
||||||
|
|
9
Oqtane.Shared/Shared/ControllerRoutes.cs
Normal file
9
Oqtane.Shared/Shared/ControllerRoutes.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Oqtane.Shared {
|
||||||
|
public class ControllerRoutes {
|
||||||
|
public const string Default = "{alias}/api/[controller]";
|
||||||
|
}
|
||||||
|
}
|
9
Oqtane.Shared/Shared/PaneNames.cs
Normal file
9
Oqtane.Shared/Shared/PaneNames.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Oqtane.Shared {
|
||||||
|
public class PaneNames {
|
||||||
|
public const string Admin = "Admin";
|
||||||
|
}
|
||||||
|
}
|
10
Oqtane.Shared/Shared/PolicyNames.cs
Normal file
10
Oqtane.Shared/Shared/PolicyNames.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Oqtane.Shared {
|
||||||
|
public class PolicyNames {
|
||||||
|
public const string ViewModule = "ViewModule";
|
||||||
|
public const string EditModule = "EditModule";
|
||||||
|
}
|
||||||
|
}
|
8
Oqtane.Shared/Shared/RoleNames.cs
Normal file
8
Oqtane.Shared/Shared/RoleNames.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Oqtane.Shared {
|
||||||
|
public class RoleNames {
|
||||||
|
public const string Everyone = "All Users";
|
||||||
|
public const string Host = "Host Users";
|
||||||
|
public const string Admin = "Administrators";
|
||||||
|
public const string Registered = "Registered Users";
|
||||||
|
}
|
||||||
|
}
|
9
Oqtane.Shared/Shared/TenantNames.cs
Normal file
9
Oqtane.Shared/Shared/TenantNames.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Oqtane.Shared {
|
||||||
|
public class TenantNames {
|
||||||
|
public const string Master = "Master";
|
||||||
|
}
|
||||||
|
}
|
9
Oqtane.Shared/Shared/UserNames.cs
Normal file
9
Oqtane.Shared/Shared/UserNames.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Oqtane.Shared {
|
||||||
|
public class UserNames {
|
||||||
|
public const string Host = "host";
|
||||||
|
}
|
||||||
|
}
|
|
@ -65,7 +65,7 @@ Future Consideration
|
||||||
- [ ] DB Migrations for framework installation/upgrade
|
- [ ] DB Migrations for framework installation/upgrade
|
||||||
- [ ] Support for SQLite
|
- [ ] Support for SQLite
|
||||||
- [ ] Generic Repository Pattern
|
- [ ] Generic Repository Pattern
|
||||||
- [ ] JwT token authentication ( possibly using IdentityServer )
|
- [ ] Support for other Auth providers
|
||||||
- [ ] Optional Encryption for Settings Values
|
- [ ] Optional Encryption for Settings Values
|
||||||
|
|
||||||
# Background
|
# Background
|
||||||
|
|
Loading…
Reference in New Issue
Block a user