Skip to content

Commit 861afaa

Browse files
authored
Merge pull request #197 from dotnetcore/dev
Correct naming;
2 parents 7b9e57a + b10e889 commit 861afaa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1811
-921
lines changed

src/AgileConfig.Server.Apisite/Appsettings.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using AgileConfig.Server.Common;
22
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Threading.Tasks;
63

74
namespace AgileConfig.Server.Apisite
85
{

src/AgileConfig.Server.Apisite/Controllers/AdminController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Microsoft.AspNetCore.Authorization;
99
using Microsoft.AspNetCore.Mvc;
1010
using System.Linq;
11-
using System.Dynamic;
1211
using AgileConfig.Server.Apisite.Utilites;
1312
using AgileConfig.Server.OIDC;
1413
using System.Collections.Generic;
@@ -21,15 +20,15 @@ public class AdminController : Controller
2120
{
2221
private readonly ISettingService _settingService;
2322
private readonly IUserService _userService;
24-
private readonly IPremissionService _permissionService;
23+
private readonly IPermissionService _permissionService;
2524
private readonly IJwtService _jwtService;
2625
private readonly IOidcClient _oidcClient;
2726
private readonly ITinyEventBus _tinyEventBus;
2827

2928
public AdminController(
3029
ISettingService settingService,
3130
IUserService userService,
32-
IPremissionService permissionService,
31+
IPermissionService permissionService,
3332
IJwtService jwtService,
3433
IOidcClient oidcClient,
3534
ITinyEventBus tinyEventBus)

src/AgileConfig.Server.Apisite/Controllers/AppController.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ namespace AgileConfig.Server.Apisite.Controllers
2020
public class AppController : Controller
2121
{
2222
private readonly IAppService _appService;
23-
private readonly IPremissionService _premissionService;
23+
private readonly IPermissionService _permissionService;
2424
private readonly IUserService _userService;
2525
private readonly ITinyEventBus _tinyEventBus;
2626

2727
public AppController(IAppService appService,
28-
IPremissionService premissionService,
28+
IPermissionService permissionService,
2929
IUserService userService,
3030
ITinyEventBus tinyEventBus)
3131
{
3232
_userService = userService;
3333
_tinyEventBus = tinyEventBus;
3434
_appService = appService;
35-
_premissionService = premissionService;
35+
_permissionService = permissionService;
3636
}
3737

3838
public async Task<IActionResult> Search(string name, string id, string group, string sortField,
@@ -112,7 +112,7 @@ private async Task AppendInheritancedInfo(List<AppListVM> list)
112112
}
113113
}
114114

115-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Add", Functions.App_Add })]
115+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Add", Functions.App_Add })]
116116
[HttpPost]
117117
public async Task<IActionResult> Add([FromBody] AppVM model)
118118
{
@@ -161,7 +161,7 @@ public async Task<IActionResult> Add([FromBody] AppVM model)
161161
});
162162
}
163163

164-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Edit", Functions.App_Edit })]
164+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Edit", Functions.App_Edit })]
165165
[HttpPost]
166166
public async Task<IActionResult> Edit([FromBody] AppVM model)
167167
{
@@ -272,10 +272,10 @@ public async Task<IActionResult> Get(string id)
272272
/// </summary>
273273
/// <param name="id"></param>
274274
/// <returns></returns>
275-
[TypeFilter(typeof(PremissionCheckAttribute),
276-
Arguments = new object[] { "App.DisableOrEanble", Functions.App_Edit })]
275+
[TypeFilter(typeof(PermissionCheckAttribute),
276+
Arguments = new object[] { "App.DisableOrEnable", Functions.App_Edit })]
277277
[HttpPost]
278-
public async Task<IActionResult> DisableOrEanble(string id)
278+
public async Task<IActionResult> DisableOrEnable(string id)
279279
{
280280
ArgumentException.ThrowIfNullOrEmpty(id);
281281

@@ -305,7 +305,7 @@ public async Task<IActionResult> DisableOrEanble(string id)
305305
});
306306
}
307307

308-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Delete", Functions.App_Delete })]
308+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Delete", Functions.App_Delete })]
309309
[HttpPost]
310310
public async Task<IActionResult> Delete(string id)
311311
{
@@ -372,16 +372,16 @@ public async Task<IActionResult> InheritancedApps(string currentAppId)
372372
/// </summary>
373373
/// <param name="model"></param>
374374
/// <returns></returns>
375-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "App.Auth", Functions.App_Auth })]
375+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "App.Auth", Functions.App_Auth })]
376376
[HttpPost]
377377
public async Task<IActionResult> SaveAppAuth([FromBody] AppAuthVM model)
378378
{
379379
ArgumentNullException.ThrowIfNull(model);
380380

381381
var result = await _appService.SaveUserAppAuth(model.AppId, model.EditConfigPermissionUsers,
382-
_premissionService.EditConfigPermissionKey);
382+
_permissionService.EditConfigPermissionKey);
383383
var result1 = await _appService.SaveUserAppAuth(model.AppId, model.PublishConfigPermissionUsers,
384-
_premissionService.PublishConfigPermissionKey);
384+
_permissionService.PublishConfigPermissionKey);
385385

386386
return Json(new
387387
{
@@ -399,10 +399,10 @@ public async Task<IActionResult> GetUserAppAuth(string appId)
399399
AppId = appId
400400
};
401401
result.EditConfigPermissionUsers =
402-
(await _appService.GetUserAppAuth(appId, _premissionService.EditConfigPermissionKey)).Select(x => x.Id)
402+
(await _appService.GetUserAppAuth(appId, _permissionService.EditConfigPermissionKey)).Select(x => x.Id)
403403
.ToList();
404404
result.PublishConfigPermissionUsers =
405-
(await _appService.GetUserAppAuth(appId, _premissionService.PublishConfigPermissionKey))
405+
(await _appService.GetUserAppAuth(appId, _permissionService.PublishConfigPermissionKey))
406406
.Select(x => x.Id).ToList();
407407

408408
return Json(new

src/AgileConfig.Server.Apisite/Controllers/ConfigController.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ITinyEventBus tinyEventBus
3939
_tinyEventBus = tinyEventBus;
4040
}
4141

42-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "Config.Add", Functions.Config_Add })]
42+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "Config.Add", Functions.Config_Add })]
4343
[HttpPost]
4444
public async Task<IActionResult> Add([FromBody] ConfigVM model, EnvString env)
4545
{
@@ -94,7 +94,7 @@ public async Task<IActionResult> Add([FromBody] ConfigVM model, EnvString env)
9494
});
9595
}
9696

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

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

366-
[TypeFilter(typeof(PremissionCheckAttribute),
366+
[TypeFilter(typeof(PermissionCheckAttribute),
367367
Arguments = new object[] { "Config.Delete", Functions.Config_Delete })]
368368
[HttpPost]
369369
public async Task<IActionResult> Delete(string id, EnvString env)
@@ -406,7 +406,7 @@ public async Task<IActionResult> Delete(string id, EnvString env)
406406
});
407407
}
408408

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

459459

460-
[TypeFilter(typeof(PremissionCheckAttribute),
460+
[TypeFilter(typeof(PermissionCheckAttribute),
461461
Arguments = new object[] { "Config.Rollback", Functions.Config_Publish })]
462462
[HttpPost]
463463
public async Task<IActionResult> Rollback(string publishTimelineId, EnvString env)
@@ -516,7 +516,7 @@ public async Task<IActionResult> ConfigPublishedHistory(string configId, EnvStri
516516
/// 发布所有待发布的配置项
517517
/// </summary>
518518
/// <returns></returns>
519-
[TypeFilter(typeof(PremissionCheckAttribute),
519+
[TypeFilter(typeof(PermissionCheckAttribute),
520520
Arguments = new object[] { "Config.Publish", Functions.Config_Publish })]
521521
[HttpPost]
522522
public async Task<IActionResult> Publish([FromBody] PublishLogVM model, EnvString env)
@@ -733,7 +733,7 @@ public async Task<IActionResult> CancelSomeEdit([FromBody] List<string> ids, Env
733733
});
734734
}
735735

736-
[TypeFilter(typeof(PremissionCheckAttribute),
736+
[TypeFilter(typeof(PermissionCheckAttribute),
737737
Arguments = new object[] { "Config.EvnSync", Functions.Config_Add })]
738738
[HttpPost]
739739
public async Task<IActionResult> SyncEnv([FromBody] List<string> toEnvs, [FromQuery] string appId,

src/AgileConfig.Server.Apisite/Controllers/HomeController.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.AspNetCore.Mvc;
55
using System.Threading.Tasks;
66
using System.Linq;
7+
using System.Reflection;
78
using AgileConfig.Server.Apisite.Utilites;
89
using AgileConfig.Server.OIDC;
910

@@ -14,13 +15,12 @@ public class HomeController : Controller
1415
{
1516
private readonly ISettingService _settingService;
1617
private readonly IUserService _userService;
17-
private readonly IPremissionService _permissionService;
18+
private readonly IPermissionService _permissionService;
1819

1920
public HomeController(
2021
ISettingService settingService,
2122
IUserService userService,
22-
IPremissionService permissionService,
23-
IOidcClient oidcClient
23+
IPermissionService permissionService
2424
)
2525
{
2626
_settingService = settingService;
@@ -76,7 +76,7 @@ public async Task<IActionResult> Current()
7676
[AllowAnonymous]
7777
public async Task<IActionResult> Sys()
7878
{
79-
string appVer = System.Reflection.Assembly.GetAssembly(typeof(AgileConfig.Server.Apisite.Program)).GetName().Version.ToString();
79+
string appVer = Assembly.GetAssembly(typeof(Program))?.GetName()?.Version?.ToString();
8080
string userName = this.GetCurrentUserName();
8181
if (string.IsNullOrEmpty(userName))
8282
{
@@ -110,7 +110,7 @@ public IActionResult Echo()
110110
[AllowAnonymous]
111111
public IActionResult GetIP()
112112
{
113-
return Content(String.Join(',', IPExt.GetEndpointIp()));
113+
return Content(String.Join(',', IpExt.GetEndpointIp()));
114114
}
115115
}
116116
}

src/AgileConfig.Server.Apisite/Controllers/RemoteOPController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ namespace AgileConfig.Server.Apisite.Controllers
1111
/// <summary>
1212
/// 这个Controller用来接受其它节点发送过来的命令
1313
/// </summary>
14-
public class RemoteOPController : Controller
14+
public class RemoteOpController : Controller
1515
{
1616
private readonly IConfigService _configService;
1717
private readonly IServiceInfoService _serviceInfoService;
1818
private readonly ILogger _logger;
19-
public RemoteOPController(IConfigService configService,
19+
public RemoteOpController(IConfigService configService,
2020
IServiceInfoService serviceInfoService,
2121
ILoggerFactory loggerFactory)
2222
{

src/AgileConfig.Server.Apisite/Controllers/ReportController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using AgileConfig.Server.Apisite.Models;
65
using AgileConfig.Server.Apisite.Websocket;
7-
using AgileConfig.Server.Common;
86
using AgileConfig.Server.Data.Entity;
97
using AgileConfig.Server.IService;
108
using Microsoft.AspNetCore.Mvc;

src/AgileConfig.Server.Apisite/Controllers/SSOController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
namespace AgileConfig.Server.Apisite.Controllers
77
{
8-
public class SSOController : Controller
8+
public class SsoController : Controller
99
{
1010
private readonly IOidcClient _oidcClient;
1111

12-
public SSOController(IOidcClient oidcClient)
12+
public SsoController(IOidcClient oidcClient)
1313
{
1414
_oidcClient = oidcClient;
1515
}

src/AgileConfig.Server.Apisite/Controllers/ServerNodeController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ITinyEventBus tinyEventBus
3434
_tinyEventBus = tinyEventBus;
3535
}
3636

37-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "Node.Add", Functions.Node_Add })]
37+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "Node.Add", Functions.Node_Add })]
3838
[HttpPost]
3939
public async Task<IActionResult> Add([FromBody] ServerNodeVM model)
4040
{
@@ -74,7 +74,7 @@ public async Task<IActionResult> Add([FromBody] ServerNodeVM model)
7474
});
7575
}
7676

77-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "Node.Delete", Functions.Node_Delete })]
77+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "Node.Delete", Functions.Node_Delete })]
7878
[HttpPost]
7979
public async Task<IActionResult> Delete([FromBody] ServerNodeVM model)
8080
{

src/AgileConfig.Server.Apisite/Controllers/ServiceController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task<IActionResult> Add([FromBody] ServiceInfoVM model)
3737
{
3838
if (model == null)
3939
{
40-
throw new ArgumentNullException("model");
40+
throw new ArgumentNullException(nameof(model));
4141
}
4242

4343
if ((await _serviceInfoService.GetByServiceIdAsync(model.ServiceId)) != null)

src/AgileConfig.Server.Apisite/Controllers/SysLogController.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Threading.Tasks;
3-
using AgileConfig.Server.Apisite.Filters;
43
using AgileConfig.Server.Data.Entity;
54
using AgileConfig.Server.IService;
65
using Microsoft.AspNetCore.Authorization;
@@ -32,10 +31,8 @@ public async Task<IActionResult> Search(string appId, SysLogType? logType, DateT
3231

3332
var pageList = await _sysLogService.SearchPage(appId, logType, startTime, endTime?.Date.AddDays(1), pageSize, current);
3433
var total = await _sysLogService.Count(appId, logType, startTime, endTime?.Date.AddDays(1));
35-
var totalPages = total / pageSize;
3634
if ((total % pageSize) > 0)
3735
{
38-
totalPages++;
3936
}
4037

4138
return Json(new

src/AgileConfig.Server.Apisite/Controllers/UserController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task<IActionResult> Search(string userName, string team, int curren
8686
});
8787
}
8888

89-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.Add", Functions.User_Add })]
89+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.Add", Functions.User_Add })]
9090
[HttpPost]
9191
public async Task<IActionResult> Add([FromBody] UserVM model)
9292
{
@@ -130,7 +130,7 @@ public async Task<IActionResult> Add([FromBody] UserVM model)
130130
});
131131
}
132132

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

170170
const string DefaultPassword = "123456";
171171

172-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.ResetPassword", Functions.User_Edit })]
172+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.ResetPassword", Functions.User_Edit })]
173173
[HttpPost]
174174
public async Task<IActionResult> ResetPassword(string userId)
175175
{
@@ -203,7 +203,7 @@ public async Task<IActionResult> ResetPassword(string userId)
203203
});
204204
}
205205

206-
[TypeFilter(typeof(PremissionCheckAttribute), Arguments = new object[] { "User.Delete", Functions.User_Delete })]
206+
[TypeFilter(typeof(PermissionCheckAttribute), Arguments = new object[] { "User.Delete", Functions.User_Delete })]
207207
[HttpPost]
208208
public async Task<IActionResult> Delete(string userId)
209209
{

0 commit comments

Comments
 (0)