mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 10:08:04 +08:00
完成直接为用户分配模块
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Mvc.Models;
|
||||
using WebGrease.Css.Extensions;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
@@ -69,5 +73,21 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public string AccessModule(int userId, string moduleIds)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ids = moduleIds.Split(',').Select(id => int.Parse(id)).ToArray();
|
||||
_app.AccessModules(userId, ids);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BjuiResponse.message = e.Message;
|
||||
BjuiResponse.statusCode = "300";
|
||||
}
|
||||
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
}
|
||||
}
|
@@ -30,8 +30,14 @@
|
||||
var selected = getSelected(2);
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('UserManager/AccessModule', function (json) {
|
||||
//授权操作
|
||||
$.post('UserManager/AccessModule', { userId: selected, moduleIds: accessIds },
|
||||
function (json) {
|
||||
var rel = $.parseJSON(json);
|
||||
if (rel.statusCode == "200") {
|
||||
$(this).alertmsg('ok', rel.message);
|
||||
} else {
|
||||
$(this).alertmsg('error', rel.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -43,6 +43,7 @@
|
||||
<component type=" OpenAuth.Repository.OrgRepository" service="OpenAuth.Domain.Interface.IOrgRepository,OpenAuth.Domain" />
|
||||
<component type=" OpenAuth.Repository.RoleRepository" service="OpenAuth.Domain.Interface.IRoleRepository,OpenAuth.Domain" />
|
||||
<component type=" OpenAuth.Repository.ModuleRepository" service="OpenAuth.Domain.Interface.IModuleRepository,OpenAuth.Domain" />
|
||||
<component type=" OpenAuth.Repository.UserModuleRepository" service="OpenAuth.Domain.Interface.IUserModuleRepository,OpenAuth.Domain" />
|
||||
</components>
|
||||
</autofac>
|
||||
|
||||
|
Reference in New Issue
Block a user