add : addPartner Auto Permission_Modules_Client

master
luoyang14z7 7 years ago
parent ac472773f6
commit 9e5e07daef

@ -8,9 +8,7 @@ import org.hibernate.validator.constraints.NotEmpty;
* Created by yangluo on 2018/07/05. * Created by yangluo on 2018/07/05.
*/ */
public class PartnerModuleInfo { public class PartnerModuleInfo {
@NotEmpty
@JSONField(name= "Module_id")
private String moduleId;
@JSONField(name = "js_module") @JSONField(name = "js_module")
private String jsModule; private String jsModule;
@JSONField(name = "js_path") @JSONField(name = "js_path")
@ -19,13 +17,6 @@ public class PartnerModuleInfo {
@JSONField(name = "initialize") @JSONField(name = "initialize")
private Boolean initialize; private Boolean initialize;
public String getModuleId() {
return moduleId;
}
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
public String getJsModule() { public String getJsModule() {
return jsModule; return jsModule;
} }
@ -59,7 +50,7 @@ public class PartnerModuleInfo {
} }
public void initObject(JSONObject mod) { public void initObject(JSONObject mod) {
mod.put("id", getModuleId()); mod.put("id", mod.getLong("id"));
mod.put("js_module", getJsModule()); mod.put("js_module", getJsModule());
mod.put("js_path", getJsPath()); mod.put("js_path", getJsPath());
mod.put("remark", getRemark()); mod.put("remark", getRemark());

@ -10,7 +10,7 @@ import java.util.List;
/** /**
* Created by yangluo on 2018/07/05. * Created by yangluo on 2018/07/05.
*/ */
public interface PartnerPermissionManager { public interface PermissionPartnerManager {
void synchronizeFunctions(); void synchronizeFunctions();
JSONObject listFunctions(); JSONObject listFunctions();

@ -2,7 +2,7 @@ package au.com.royalpay.payment.manage.management.sysconfig.core.impls;
import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo; import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo; import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
import au.com.royalpay.payment.manage.management.sysconfig.core.PartnerPermissionManager; import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper; import au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerFunctionMapper; import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerFunctionMapper;
@ -32,7 +32,7 @@ import javax.annotation.Resource;
* Created by yangluo on 2018/07/05. * Created by yangluo on 2018/07/05.
*/ */
@Service @Service
public class PartnerPermissionManagerImpl implements PartnerPermissionManager { public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
@Resource @Resource
private PermissionPartnerFunctionMapper permissionPartnerFunctionMapper; private PermissionPartnerFunctionMapper permissionPartnerFunctionMapper;
@Resource @Resource
@ -136,18 +136,20 @@ public class PartnerPermissionManagerImpl implements PartnerPermissionManager {
clientMod.put("id", IdUtil.getId()); clientMod.put("id", IdUtil.getId());
permissionClientModulesService.save(clientMod); permissionClientModulesService.save(clientMod);
} }
} } else {
if (!module.getInitialize()) {
for (JSONObject clientMod : IdandMoniker) { for (JSONObject clientMod : IdandMoniker) {
clientMod.put("client_id", clientMod.getString("client_id")); clientMod.put("client_id", clientMod.getString("client_id"));
clientMod.put("client_moniker", clientMod.getString("client_moniker")); clientMod.put("client_moniker", clientMod.getString("client_moniker"));
clientMod.put("module_id", nModuleId.getString("id")); clientMod.put("module_id", nModuleId.getString("id"));
clientMod.put("is_valid", 0); clientMod.put("is_valid", 0);
clientMod.put("is_valid", IdUtil.getId()); clientMod.put("id", IdUtil.getId());
permissionClientModuleMapper.save(clientMod); permissionClientModuleMapper.save(clientMod);
} }
} }
}
}
module.initObject(mod); module.initObject(mod);
permissionPartnerModuleMapper.update(mod); permissionPartnerModuleMapper.update(mod);

@ -2,7 +2,7 @@ package au.com.royalpay.payment.manage.management.sysconfig.web;
import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo; import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo; import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
import au.com.royalpay.payment.manage.management.sysconfig.core.PartnerPermissionManager; import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -22,44 +22,44 @@ import javax.annotation.Resource;
* Created by yangluo on 2018/07/05. * Created by yangluo on 2018/07/05.
*/ */
@RestController @RestController
@RequestMapping( value = "/sys/partnerPermission") @RequestMapping( value = "/sys/permissionPartner")
public class SysPermissionPartnerConfigController { public class SysPermissionPartnerConfigController {
@Resource @Resource
private PartnerPermissionManager patnerPermissionManager; private PermissionPartnerManager permissionPartnerManager;
@RequestMapping(value = "/synchronize", method = RequestMethod.POST) @RequestMapping(value = "/synchronize", method = RequestMethod.POST)
public void synchronizeFunctions() { public void synchronizeFunctions() {
patnerPermissionManager.synchronizeFunctions(); permissionPartnerManager.synchronizeFunctions();
} }
@RequestMapping(value = "/functions", method = RequestMethod.GET) @RequestMapping(value = "/functions", method = RequestMethod.GET)
public JSONObject listFunctions() { public JSONObject listFunctions() {
return patnerPermissionManager.listFunctions(); return permissionPartnerManager.listFunctions();
} }
@RequestMapping(value = "/functions/{funcId}.end", method = RequestMethod.PUT) @RequestMapping(value = "/functions/{funcId}.end", method = RequestMethod.PUT)
public void updateFunctionInfo(@PathVariable String funcId, @RequestBody FuncInfo funcInfo) { public void updateFunctionInfo(@PathVariable String funcId, @RequestBody FuncInfo funcInfo) {
patnerPermissionManager.updateFuncInfo(funcId, funcInfo); permissionPartnerManager.updateFuncInfo(funcId, funcInfo);
} }
@RequestMapping(value = "/functions/{funcId}/modules", method = RequestMethod.PUT) @RequestMapping(value = "/functions/{funcId}/modules", method = RequestMethod.PUT)
public void setFuncModule(@PathVariable String funcId, @RequestBody JSONObject module) { public void setFuncModule(@PathVariable String funcId, @RequestBody JSONObject module) {
patnerPermissionManager.setFunctionModule(funcId, module.getString("module_name")); permissionPartnerManager.setFunctionModule(funcId, module.getString("module_name"));
} }
@RequestMapping(value = "/modules", method = RequestMethod.GET) @RequestMapping(value = "/modules", method = RequestMethod.GET)
public List<JSONObject> listModuless() { public List<JSONObject> listModuless() {
return patnerPermissionManager.listModules(); return permissionPartnerManager.listModules();
} }
@RequestMapping(value = "/modules/{moduleName}.end", method = RequestMethod.PUT) @RequestMapping(value = "/modules/{moduleName}.end", method = RequestMethod.PUT)
public void updateModulee(@PathVariable String moduleName, @RequestBody PartnerModuleInfo module) { public void updateModulee(@PathVariable String moduleName, @RequestBody PartnerModuleInfo module) {
patnerPermissionManager.saveOrUpdateModule(moduleName, module); permissionPartnerManager.saveOrUpdateModule(moduleName, module);
} }
@RequestMapping(value = "/modules/{moduleName}.end", method = RequestMethod.DELETE) @RequestMapping(value = "/modules/{moduleName}.end", method = RequestMethod.DELETE)
public void deleteModulee(@PathVariable String moduleName) { public void deleteModulee(@PathVariable String moduleName) {
patnerPermissionManager.checkAndDeleteModule(moduleName); permissionPartnerManager.checkAndDeleteModule(moduleName);
} }
@RequestMapping(value = "/roles/{roleMask}/functions", method = RequestMethod.GET) @RequestMapping(value = "/roles/{roleMask}/functions", method = RequestMethod.GET)
@ -68,7 +68,7 @@ public class SysPermissionPartnerConfigController {
int mask = Integer.parseInt(roleMask, 2); int mask = Integer.parseInt(roleMask, 2);
for (ManagerRole role : ManagerRole.values()) { for (ManagerRole role : ManagerRole.values()) {
if (mask == role.getMask()) { if (mask == role.getMask()) {
return patnerPermissionManager.listRoleFunctions(role); return permissionPartnerManager.listRoleFunctions(role);
} }
} }
@ -83,7 +83,7 @@ public class SysPermissionPartnerConfigController {
int mask = Integer.parseInt(roleMask, 2); int mask = Integer.parseInt(roleMask, 2);
for (ManagerRole role : ManagerRole.values()) { for (ManagerRole role : ManagerRole.values()) {
if (mask == role.getMask()) { if (mask == role.getMask()) {
patnerPermissionManager.authorizeRole(role,functions); permissionPartnerManager.authorizeRole(role,functions);
return; return;
} }
} }

@ -19,11 +19,8 @@ public interface PermissionClientModuleMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject clientmodules); void save(JSONObject clientmodules);
@AutoSql(type = SqlType.COUNT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
int count(@Param("id") String moduleId);
void delete(@Param("module_name") String moduleName); void delete(@Param("module_name") String moduleName);
} }

@ -32,4 +32,5 @@ public interface PermissionPartnerModuleMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
JSONObject listModuleId(@Param("module_name") String moduleName); JSONObject listModuleId(@Param("module_name") String moduleName);
} }

@ -264,6 +264,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClearingLogMapper clearingLogMapper; private ClearingLogMapper clearingLogMapper;
@Resource @Resource
private ClientConfigMapper clientConfigMapper; private ClientConfigMapper clientConfigMapper;
@Resource
private PermissionPartnerModuleMapper permissionPartnerModuleMapper;
@Resource
private PermissionClientModuleMapper permissionClientModuleMapper;
@ -557,11 +561,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
} }
try { try {
clientMapper.save(partner); clientMapper.save(partner);
JSONObject clientConfig = new JSONObject(); JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id", partner.getIntValue("client_id")); clientConfig.put("client_id", partner.getIntValue("client_id"));
clientConfig.put("client_moniker", partner.getString("client_moniker")); clientConfig.put("client_moniker", partner.getString("client_moniker"));
clientConfigService.save(clientConfig); clientConfigService.save(clientConfig);
List<JSONObject> moduleId = permissionPartnerModuleMapper.list();
for (JSONObject moduleClientAdd : moduleId) {
moduleClientAdd.put("client_id", partner.getIntValue("client_id"));
moduleClientAdd.put("client_moniker", partner.getString("client_moniker"));
moduleClientAdd.put("module_id", moduleClientAdd.getString("id"));
moduleClientAdd.put("is_valid", 1);
permissionClientModuleMapper.save(moduleClientAdd);
}
} catch (Exception e) { } catch (Exception e) {
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
} }

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.PartnerPermissionFunctionMapper">
<sql id="joinModule">
SELECT
f.*,
m.js_module,
m.js_path,
m.remark mod_remark
FROM sys_permission_partner_functions f
LEFT JOIN sys_permission_partner_modules m ON m.module_name and m.id = f.module_id
</sql>
<update id="clearRolePermission">
<![CDATA[
UPDATE sys_permission_partner_functions
SET role = role & #{mask}
]]>
</update>
<update id="authorizeRole">
<![CDATA[
UPDATE sys_permission_partner_functions
SET role = role | #{mask}
WHERE func_id in
]]>
<foreach collection="func_ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
<select id="listByRoleMask" resultType="com.alibaba.fastjson.JSONObject">
<include refid="joinModule"/>
<![CDATA[
WHERE f.role & #{mask} >0
]]>
</select>
<select id="listAll" resultType="com.alibaba.fastjson.JSONObject">
<include refid="joinModule"/>
ORDER BY f.module ASC,f.func_id ASC,f.module_id ASC
</select>
</mapper>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper">
<!-- <select id="listModuleId" resultType="com.alibaba.fastjson.JSONObject" >
select id from sys_permission_partner_modules where module_name=#{module_name}
</select>
<update id="update">
update sys_permission_partner_modules set js_module=#{js_module},remark=#{remark},js_path=#{js_path}
where module_name = #{module_name}
</update>
<insert id="save">
insert into sys_permission_partner_modules(module_name,js_module,js_path,remark) value (#{module_name},#{js_module},#{js_path},#{remark})
</insert>-->
</mapper>

@ -3,6 +3,6 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper">
<delete id="delete"> <delete id="delete">
delete from sys_permission_partner_modules_clients delete from sys_permission_partner_modules_clients
where sys_permission_partner_modules_clients.module_id = (SELECT module_id from sys_permission_partner_modules where module_name=#{module_name}) where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name})
</delete> </delete>
</mapper> </mapper>

@ -39,21 +39,21 @@ define(['angular', 'uiRouter'], function (angular) {
templateUrl: '/static/config/sysconfigs/templates/payemnt_config.html', templateUrl: '/static/config/sysconfigs/templates/payemnt_config.html',
controller: 'paymentConfigCtrl' controller: 'paymentConfigCtrl'
})*/ })*/
.state('sysconfig.partnerPermission', { .state('sysconfig.permissionPartner', {
url: '/partnerPermission', url: '/permissionPartner',
templateUrl: '/static/config/sysconfigs/templates/partnerPermission_config.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_config.html',
controller: 'partnerPermissionConfigRootCtrl' controller: 'permissionPartnerConfigRootCtrl'
}).state('sysconfig.partnerPermission.functions', { }).state('sysconfig.permissionPartner.functions', {
url: '/partnerFunctions', url: '/partnerFunctions',
templateUrl: '/static/config/sysconfigs/templates/partnerPermission_functions.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_functions.html',
controller: 'partnerPermissionFuncCtrl' controller: 'permissionPartnerFuncCtrl'
}).state('sysconfig.partnerPermission.modules', { }).state('sysconfig.permissionPartner.modules', {
url: '/partnerModules', url: '/partnerModules',
templateUrl: '/static/config/sysconfigs/templates/partnerPermission_modules.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_modules.html',
controller: 'partnerPermissionModuleCtrl', controller: 'permissionPartnerModuleCtrl',
resolve: { resolve: {
modules: ['$http', function ($http) { modules: ['$http', function ($http) {
return $http.get('/sys/partnerPermission/modules') return $http.get('/sys/permissionPartner/modules')
}] }]
} }
}) })
@ -326,18 +326,18 @@ define(['angular', 'uiRouter'], function (angular) {
}) })
} }
}]);*/ }]);*/
app.controller('partnerPermissionConfigRootCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { app.controller('permissionPartnerConfigRootCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
$scope.authorizeRole = function (roleMask) { $scope.authorizeRole = function (roleMask) {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/config/sysconfigs/templates/PartnerPermission_authorize_dialog.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_authorize_dialog.html',
controller: 'partnerPermissionAuthorizeDialogCtrl', controller: 'permissionPartnerAuthorizeDialogCtrl',
size: 'lg', size: 'lg',
resolve: { resolve: {
authorized: ['$http', function ($http) { authorized: ['$http', function ($http) {
return $http.get('/sys/partnerPermission/roles/' + roleMask + '/functions'); return $http.get('/sys/permissionPartner/roles/' + roleMask + '/functions');
}], }],
modules: ['$http', function ($http) { modules: ['$http', function ($http) {
return $http.get('/sys/partnerPermission/functions'); return $http.get('/sys/permissionPartner/functions');
}], }],
role: function () { role: function () {
return roleMask return roleMask
@ -346,13 +346,13 @@ define(['angular', 'uiRouter'], function (angular) {
}); });
} }
}]); }]);
app.controller('partnerPermissionAuthorizeDialogCtrl', ['$scope', '$http', 'authorized', 'modules', 'role', app.controller('permissionPartnerAuthorizeDialogCtrl', ['$scope', '$http', 'authorized', 'modules', 'role',
function ($scope, $http, authorized, modules, role) { function ($scope, $http, authorized, modules, role) {
$scope.authorized = authorized.data; $scope.authorized = authorized.data;
$scope.modules = modules.data; $scope.modules = modules.data;
$scope.submitAuthorize = function () { $scope.submitAuthorize = function () {
$scope.errmsg = null; $scope.errmsg = null;
$http.put('/sys/partnerPermission/roles/' + role + '/functions', $scope.authorized).then(function () { $http.put('/sys/permissionPartner/roles/' + role + '/functions', $scope.authorized).then(function () {
$scope.$close(); $scope.$close();
}, function (resp) { }, function (resp) {
$scope.errmsg = resp.data.message; $scope.errmsg = resp.data.message;
@ -368,17 +368,17 @@ define(['angular', 'uiRouter'], function (angular) {
} }
}] }]
); );
app.controller('partnerPermissionFuncCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', app.controller('permissionPartnerFuncCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog',
function ($scope, $http, $state, $uibModal, commonDialog) { function ($scope, $http, $state, $uibModal, commonDialog) {
$scope.loadFunctions = function () { $scope.loadFunctions = function () {
$http.get('/sys/partnerPermission/functions').then(function (functions) { $http.get('/sys/permissionPartner/functions').then(function (functions) {
$scope.modFunctions = functions.data; $scope.modFunctions = functions.data;
}) })
}; };
$scope.loadFunctions(); $scope.loadFunctions();
$scope.loadModules = function () { $scope.loadModules = function () {
$http.get('/sys/partnerPermission/modules').then(function (modules) { $http.get('/sys/permissionPartner/modules').then(function (modules) {
$scope.modules = modules.data; $scope.modules = modules.data;
}) })
}; };
@ -387,21 +387,21 @@ define(['angular', 'uiRouter'], function (angular) {
$scope.syncFunctions = function () { $scope.syncFunctions = function () {
$http.post('/sys/partnerPermission/synchronize').then(function () { $http.post('/sys/permissionPartner/synchronize').then(function () {
$scope.loadFunctions(); $scope.loadFunctions();
}) })
}; };
$scope.moveFunction = function (func) { $scope.moveFunction = function (func) {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/config/sysconfigs/templates/partnerPermission_choose_module.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_choose_module.html',
controller: 'partnerPermissionChooseModuleDialogCtrl', controller: 'permissionPartnerChooseModuleDialogCtrl',
resolve: { resolve: {
modules: function () { modules: function () {
return $scope.modules; return $scope.modules;
} }
} }
}).result.then(function (modName) { }).result.then(function (modName) {
$http.put('/sys/partnerPermission/functions/' + func.func_id + '/modules', {module_name: modName}).then(function () { $http.put('/sys/permissionPartner/functions/' + func.func_id + '/modules', {module_name: modName}).then(function () {
$scope.loadFunctions(); $scope.loadFunctions();
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -411,7 +411,7 @@ define(['angular', 'uiRouter'], function (angular) {
$scope.editFunctionInfo = function (func) { $scope.editFunctionInfo = function (func) {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/config/sysconfigs/templates/PartnerFunc_info_edit.html', templateUrl: '/static/config/sysconfigs/templates/PartnerFunc_info_edit.html',
controller: 'partnerPermissionFuncEditDialogCtrl', controller: 'permissionPartnerFuncEditDialogCtrl',
resolve: { resolve: {
func: function () { func: function () {
return angular.copy(func); return angular.copy(func);
@ -423,29 +423,29 @@ define(['angular', 'uiRouter'], function (angular) {
} }
}] }]
); );
app.controller('partnerPermissionChooseModuleDialogCtrl', ['$scope', '$http', 'modules', function ($scope, $http, modules) { app.controller('permissionPartnerChooseModuleDialogCtrl', ['$scope', '$http', 'modules', function ($scope, $http, modules) {
$scope.modules = modules; $scope.modules = modules;
$scope.chooseModule = function (mod) { $scope.chooseModule = function (mod) {
$scope.$close(mod.module_name); $scope.$close(mod.module_name);
} }
}]); }]);
app.controller('partnerPermissionFuncEditDialogCtrl', ['$scope', '$http', 'func', function ($scope, $http, func) { app.controller('permissionPartnerFuncEditDialogCtrl', ['$scope', '$http', 'func', function ($scope, $http, func) {
$scope.func = func; $scope.func = func;
$scope.modifyFunction = function () { $scope.modifyFunction = function () {
$scope.errmsg = null; $scope.errmsg = null;
$http.put('/sys/partnerPermission/functions/' + func.func_id + '.end', $scope.func).then(function () { $http.put('/sys/permissionPartner/functions/' + func.func_id + '.end', $scope.func).then(function () {
$scope.$close(); $scope.$close();
}, function (resp) { }, function (resp) {
$scope.errmsg = resp.data.message; $scope.errmsg = resp.data.message;
}) })
}; };
}]); }]);
app.controller('partnerPermissionModuleCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', 'modules', app.controller('permissionPartnerModuleCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', 'modules',
function ($scope, $http, $state, $uibModal, commonDialog, modules) { function ($scope, $http, $state, $uibModal, commonDialog, modules) {
$scope.modules = modules.data; $scope.modules = modules.data;
$scope.newPartnerModule = function () { $scope.newPartnerModule = function () {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/config/sysconfigs/templates/PartnerPermission_module_dialog.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_module_dialog.html',
controller: 'partnerModuleNewCtrl', controller: 'partnerModuleNewCtrl',
resolve: { resolve: {
module: function () { module: function () {
@ -458,7 +458,7 @@ define(['angular', 'uiRouter'], function (angular) {
}; };
$scope.editPartnerModule = function (mod) { $scope.editPartnerModule = function (mod) {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/config/sysconfigs/templates/PartnerPermission_module_dialog.html', templateUrl: '/static/config/sysconfigs/templates/permissionPartner_module_dialog.html',
controller: 'partnerModuleEditCtrl', controller: 'partnerModuleEditCtrl',
resolve: { resolve: {
module: function () { module: function () {
@ -475,7 +475,7 @@ define(['angular', 'uiRouter'], function (angular) {
title: 'Warning', title: 'Warning',
content: 'You are deleting an exists module. Confirm?' content: 'You are deleting an exists module. Confirm?'
}).then(function () { }).then(function () {
$http.delete('/sys/partnerPermission/modules/' + mod.module_name + '.end').then(function () { $http.delete('/sys/permissionPartner/modules/' + mod.module_name + '.end').then(function () {
$state.reload(); $state.reload();
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -487,12 +487,9 @@ define(['angular', 'uiRouter'], function (angular) {
app.controller('partnerModuleEditCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) { app.controller('partnerModuleEditCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) {
$scope.module = angular.copy(module); $scope.module = angular.copy(module);
$scope.nameEditable = !module.module_name; $scope.nameEditable = !module.module_name;
$http.get('/sys/partnerPermission/modules/'+ $scope.module.module_id + '.num').then(function (num) {
$scope.module.initialize = num.data.bool;
})
$scope.save = function () { $scope.save = function () {
$scope.errmsg = null; $scope.errmsg = null;
$http.put('/sys/partnerPermission/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () { $http.put('/sys/permissionPartner/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () {
$scope.$close(); $scope.$close();
}, function (resp) { }, function (resp) {
$scope.errmsg = resp.data.message; $scope.errmsg = resp.data.message;
@ -502,10 +499,10 @@ define(['angular', 'uiRouter'], function (angular) {
app.controller('partnerModuleNewCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) { app.controller('partnerModuleNewCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) {
$scope.module = angular.copy(module); $scope.module = angular.copy(module);
$scope.nameEditable = !module.module_name; $scope.nameEditable = !module.module_name;
$scope.module.initialize = false; $scope.module.initialize = true;
$scope.save = function () { $scope.save = function () {
$scope.errmsg = null; $scope.errmsg = null;
$http.put('/sys/partnerPermission/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () { $http.put('/sys/permissionPartner/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () {
$scope.$close(); $scope.$close();
}, function (resp) { }, function (resp) {
$scope.errmsg = resp.data.message; $scope.errmsg = resp.data.message;

@ -13,7 +13,7 @@
<div class="nav-tabs-custom"> <div class="nav-tabs-custom">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li ui-sref-active-eq="active"> <li ui-sref-active-eq="active">
<a ui-sref="sysconfig.partnerPermission">Permissions</a> <a ui-sref="sysconfig.permissionPartner">Permissions</a>
</li> </li>
<li ui-sref-active="active"> <li ui-sref-active="active">
<a ui-sref=".functions">Functions</a> <a ui-sref=".functions">Functions</a>

@ -25,7 +25,7 @@
Mail Subscriptions Mail Subscriptions
</a> </a>
<a class="btn btn-app" role="button" ui-sref=".partnerPermission"> <a class="btn btn-app" role="button" ui-sref=".permissionPartner">
<i class="fa fa-key"></i> <i class="fa fa-key"></i>
Partner Permission Config Partner Permission Config
</a> </a>

Loading…
Cancel
Save