/// <summary> /// 给用户权限(分子系统) /// </summary> /// <param name="userInfo">用户</param> /// <param name="systemCode">系统编号</param> /// <param name="userId">用户主键</param> /// <param name="permissionCode">权限编号</param> /// <returns>主键</returns> public string GrantUserPermission(BaseUserInfo userInfo, string systemCode, string userId, string permissionCode) { string result = string.Empty; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) => { var userPermissionManager = new BaseUserPermissionManager(dbHelper, userInfo); result = userPermissionManager.GrantByPermissionCode(systemCode, userId, permissionCode); }); return(result); }
/// <summary> /// 给用户权限 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userName">用户名</param> /// <param name="permissionCode">权限编号</param> /// <returns>主键</returns> public string GrantUserPermission(BaseUserInfo userInfo, string userName, string permissionCode) { string result = string.Empty; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) => { var userManager = new BaseUserManager(dbHelper, userInfo); string userId = userManager.GetId(new KeyValuePair <string, object>(BaseUserEntity.FieldUserName, userName)); if (!String.IsNullOrEmpty(userId)) { var userPermissionManager = new BaseUserPermissionManager(dbHelper, userInfo); result = userPermissionManager.GrantByPermissionCode(userInfo.SystemCode, userId, permissionCode); } }); return(result); }