Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct naming; #197

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/AgileConfig.Server.Apisite/Appsettings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using AgileConfig.Server.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AgileConfig.Server.Apisite
{
Expand Down
5 changes: 2 additions & 3 deletions src/AgileConfig.Server.Apisite/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Dynamic;
using AgileConfig.Server.Apisite.Utilites;
using AgileConfig.Server.OIDC;
using System.Collections.Generic;
Expand All @@ -21,15 +20,15 @@ public class AdminController : Controller
{
private readonly ISettingService _settingService;
private readonly IUserService _userService;
private readonly IPremissionService _permissionService;
private readonly IPermissionService _permissionService;
private readonly IJwtService _jwtService;
private readonly IOidcClient _oidcClient;
private readonly ITinyEventBus _tinyEventBus;

public AdminController(
ISettingService settingService,
IUserService userService,
IPremissionService permissionService,
IPermissionService permissionService,
IJwtService jwtService,
IOidcClient oidcClient,
ITinyEventBus tinyEventBus)
Expand Down
28 changes: 14 additions & 14 deletions src/AgileConfig.Server.Apisite/Controllers/AppController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ namespace AgileConfig.Server.Apisite.Controllers
public class AppController : Controller
{
private readonly IAppService _appService;
private readonly IPremissionService _premissionService;
private readonly IPermissionService _permissionService;
private readonly IUserService _userService;
private readonly ITinyEventBus _tinyEventBus;

public AppController(IAppService appService,
IPremissionService premissionService,
IPermissionService permissionService,
IUserService userService,
ITinyEventBus tinyEventBus)
{
_userService = userService;
_tinyEventBus = tinyEventBus;
_appService = appService;
_premissionService = premissionService;
_permissionService = permissionService;
}

public async Task<IActionResult> Search(string name, string id, string group, string sortField,
Expand Down Expand Up @@ -112,7 +112,7 @@ private async Task AppendInheritancedInfo(List<AppListVM> list)
}
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Add", Functions.App_Add })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Add", Functions.App_Add })]
[HttpPost]
public async Task<IActionResult> Add([FromBody] AppVM model)
{
Expand Down Expand Up @@ -161,7 +161,7 @@ public async Task<IActionResult> Add([FromBody] AppVM model)
});
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Edit", Functions.App_Edit })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Edit", Functions.App_Edit })]
[HttpPost]
public async Task<IActionResult> Edit([FromBody] AppVM model)
{
Expand Down Expand Up @@ -272,10 +272,10 @@ public async Task<IActionResult> Get(string id)
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[TypeFilter(typeof(PremissionCheckAttribute),
Arguments = new object[] { "App.DisableOrEanble", Functions.App_Edit })]
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "App.DisableOrEnable", Functions.App_Edit })]
[HttpPost]
public async Task<IActionResult> DisableOrEanble(string id)
public async Task<IActionResult> DisableOrEnable(string id)
{
ArgumentException.ThrowIfNullOrEmpty(id);

Expand Down Expand Up @@ -305,7 +305,7 @@ public async Task<IActionResult> DisableOrEanble(string id)
});
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Delete", Functions.App_Delete })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Delete", Functions.App_Delete })]
[HttpPost]
public async Task<IActionResult> Delete(string id)
{
Expand Down Expand Up @@ -372,16 +372,16 @@ public async Task<IActionResult> InheritancedApps(string currentAppId)
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Auth", Functions.App_Auth })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Auth", Functions.App_Auth })]
[HttpPost]
public async Task<IActionResult> SaveAppAuth([FromBody] AppAuthVM model)
{
ArgumentNullException.ThrowIfNull(model);

var result = await _appService.SaveUserAppAuth(model.AppId, model.EditConfigPermissionUsers,
_premissionService.EditConfigPermissionKey);
_permissionService.EditConfigPermissionKey);
var result1 = await _appService.SaveUserAppAuth(model.AppId, model.PublishConfigPermissionUsers,
_premissionService.PublishConfigPermissionKey);
_permissionService.PublishConfigPermissionKey);

return Json(new
{
Expand All @@ -399,10 +399,10 @@ public async Task<IActionResult> GetUserAppAuth(string appId)
AppId = appId
};
result.EditConfigPermissionUsers =
(await _appService.GetUserAppAuth(appId, _premissionService.EditConfigPermissionKey)).Select(x => x.Id)
(await _appService.GetUserAppAuth(appId, _permissionService.EditConfigPermissionKey)).Select(x => x.Id)
.ToList();
result.PublishConfigPermissionUsers =
(await _appService.GetUserAppAuth(appId, _premissionService.PublishConfigPermissionKey))
(await _appService.GetUserAppAuth(appId, _permissionService.PublishConfigPermissionKey))
.Select(x => x.Id).ToList();

return Json(new
Expand Down
16 changes: 8 additions & 8 deletions src/AgileConfig.Server.Apisite/Controllers/ConfigController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ITinyEventBus tinyEventBus
_tinyEventBus = tinyEventBus;
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "Config.Add", Functions.Config_Add })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "Config.Add", Functions.Config_Add })]
[HttpPost]
public async Task<IActionResult> Add([FromBody] ConfigVM model, EnvString env)
{
Expand Down Expand Up @@ -94,7 +94,7 @@ public async Task<IActionResult> Add([FromBody] ConfigVM model, EnvString env)
});
}

[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.AddRange", Functions.Config_Add })]
[HttpPost]
public async Task<IActionResult> AddRange([FromBody] List<ConfigVM> model, EnvString env)
Expand Down Expand Up @@ -163,7 +163,7 @@ public async Task<IActionResult> AddRange([FromBody] List<ConfigVM> model, EnvSt
});
}

[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.Edit", Functions.Config_Edit })]
[HttpPost]
public async Task<IActionResult> Edit([FromBody] ConfigVM model, [FromQuery] EnvString env)
Expand Down Expand Up @@ -363,7 +363,7 @@ public async Task<IActionResult> Get(string id, EnvString env)
});
}

[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.Delete", Functions.Config_Delete })]
[HttpPost]
public async Task<IActionResult> Delete(string id, EnvString env)
Expand Down Expand Up @@ -406,7 +406,7 @@ public async Task<IActionResult> Delete(string id, EnvString env)
});
}

[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.DeleteSome", Functions.Config_Delete })]
[HttpPost]
public async Task<IActionResult> DeleteSome([FromBody] List<string> ids, EnvString env)
Expand Down Expand Up @@ -457,7 +457,7 @@ public async Task<IActionResult> DeleteSome([FromBody] List<string> ids, EnvStri
}


[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.Rollback", Functions.Config_Publish })]
[HttpPost]
public async Task<IActionResult> Rollback(string publishTimelineId, EnvString env)
Expand Down Expand Up @@ -516,7 +516,7 @@ public async Task<IActionResult> ConfigPublishedHistory(string configId, EnvStri
/// 发布所有待发布的配置项
/// </summary>
/// <returns></returns>
[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.Publish", Functions.Config_Publish })]
[HttpPost]
public async Task<IActionResult> Publish([FromBody] PublishLogVM model, EnvString env)
Expand Down Expand Up @@ -733,7 +733,7 @@ public async Task<IActionResult> CancelSomeEdit([FromBody] List<string> ids, Env
});
}

[TypeFilter(typeof(PremissionCheckAttribute),
[TypeFilter(typeof(PermissionCheckAttribute),
Arguments = new object[] { "Config.EvnSync", Functions.Config_Add })]
[HttpPost]
public async Task<IActionResult> SyncEnv([FromBody] List<string> toEnvs, [FromQuery] string appId,
Expand Down
10 changes: 5 additions & 5 deletions src/AgileConfig.Server.Apisite/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using System.Linq;
using System.Reflection;
using AgileConfig.Server.Apisite.Utilites;
using AgileConfig.Server.OIDC;

Expand All @@ -14,13 +15,12 @@ public class HomeController : Controller
{
private readonly ISettingService _settingService;
private readonly IUserService _userService;
private readonly IPremissionService _permissionService;
private readonly IPermissionService _permissionService;

public HomeController(
ISettingService settingService,
IUserService userService,
IPremissionService permissionService,
IOidcClient oidcClient
IPermissionService permissionService
)
{
_settingService = settingService;
Expand Down Expand Up @@ -76,7 +76,7 @@ public async Task<IActionResult> Current()
[AllowAnonymous]
public async Task<IActionResult> Sys()
{
string appVer = System.Reflection.Assembly.GetAssembly(typeof(AgileConfig.Server.Apisite.Program)).GetName().Version.ToString();
string appVer = Assembly.GetAssembly(typeof(Program))?.GetName()?.Version?.ToString();
string userName = this.GetCurrentUserName();
if (string.IsNullOrEmpty(userName))
{
Expand Down Expand Up @@ -110,7 +110,7 @@ public IActionResult Echo()
[AllowAnonymous]
public IActionResult GetIP()
{
return Content(String.Join(',', IPExt.GetEndpointIp()));
return Content(String.Join(',', IpExt.GetEndpointIp()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace AgileConfig.Server.Apisite.Controllers
/// <summary>
/// 这个Controller用来接受其它节点发送过来的命令
/// </summary>
public class RemoteOPController : Controller
public class RemoteOpController : Controller
{
private readonly IConfigService _configService;
private readonly IServiceInfoService _serviceInfoService;
private readonly ILogger _logger;
public RemoteOPController(IConfigService configService,
public RemoteOpController(IConfigService configService,
IServiceInfoService serviceInfoService,
ILoggerFactory loggerFactory)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AgileConfig.Server.Apisite.Models;
using AgileConfig.Server.Apisite.Websocket;
using AgileConfig.Server.Common;
using AgileConfig.Server.Data.Entity;
using AgileConfig.Server.IService;
using Microsoft.AspNetCore.Mvc;
Expand Down
4 changes: 2 additions & 2 deletions src/AgileConfig.Server.Apisite/Controllers/SSOController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace AgileConfig.Server.Apisite.Controllers
{
public class SSOController : Controller
public class SsoController : Controller
{
private readonly IOidcClient _oidcClient;

public SSOController(IOidcClient oidcClient)
public SsoController(IOidcClient oidcClient)
{
_oidcClient = oidcClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ITinyEventBus tinyEventBus
_tinyEventBus = tinyEventBus;
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "Node.Add", Functions.Node_Add })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "Node.Add", Functions.Node_Add })]
[HttpPost]
public async Task<IActionResult> Add([FromBody] ServerNodeVM model)
{
Expand Down Expand Up @@ -74,7 +74,7 @@ public async Task<IActionResult> Add([FromBody] ServerNodeVM model)
});
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "Node.Delete", Functions.Node_Delete })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "Node.Delete", Functions.Node_Delete })]
[HttpPost]
public async Task<IActionResult> Delete([FromBody] ServerNodeVM model)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task<IActionResult> Add([FromBody] ServiceInfoVM model)
{
if (model == null)
{
throw new ArgumentNullException("model");
throw new ArgumentNullException(nameof(model));
}

if ((await _serviceInfoService.GetByServiceIdAsync(model.ServiceId)) != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Threading.Tasks;
using AgileConfig.Server.Apisite.Filters;
using AgileConfig.Server.Data.Entity;
using AgileConfig.Server.IService;
using Microsoft.AspNetCore.Authorization;
Expand Down Expand Up @@ -32,10 +31,8 @@ public async Task<IActionResult> Search(string appId, SysLogType? logType, DateT

var pageList = await _sysLogService.SearchPage(appId, logType, startTime, endTime?.Date.AddDays(1), pageSize, current);
var total = await _sysLogService.Count(appId, logType, startTime, endTime?.Date.AddDays(1));
var totalPages = total / pageSize;
if ((total % pageSize) > 0)
{
totalPages++;
}

return Json(new
Expand Down
8 changes: 4 additions & 4 deletions src/AgileConfig.Server.Apisite/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public async Task<IActionResult> Search(string userName, string team, int curren
});
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.Add", Functions.User_Add })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.Add", Functions.User_Add })]
[HttpPost]
public async Task<IActionResult> Add([FromBody] UserVM model)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task<IActionResult> Add([FromBody] UserVM model)
});
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.Edit", Functions.User_Edit })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.Edit", Functions.User_Edit })]
[HttpPost]
public async Task<IActionResult> Edit([FromBody] UserVM model)
{
Expand Down Expand Up @@ -169,7 +169,7 @@ public async Task<IActionResult> Edit([FromBody] UserVM model)

const string DefaultPassword = "123456";

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.ResetPassword", Functions.User_Edit })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.ResetPassword", Functions.User_Edit })]
[HttpPost]
public async Task<IActionResult> ResetPassword(string userId)
{
Expand Down Expand Up @@ -203,7 +203,7 @@ public async Task<IActionResult> ResetPassword(string userId)
});
}

[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.Delete", Functions.User_Delete })]
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.Delete", Functions.User_Delete })]
[HttpPost]
public async Task<IActionResult> Delete(string userId)
{
Expand Down
Loading
Loading