redmine - 如何仅在 redmine 应用程序中允许某些用户远程登录(不在办公室 IP)?
问题描述
有没有办法允许一组用户从任何 IP 访问 redmine,而其他用户只能从一组 IP 登录
解决方案
目前(Redmine 4.1),没有这样的功能,但是它是一个开源软件,欢迎您在他们的跟踪器上请求这样的功能或开发自己的代码。因此,如果您很快需要解决方案,则有几种选择:
方法 1: 您可以通过让远程用户通过 VPN 连接来解决问题,这将使他们拥有来自给定 IP 集的 IP。
方法2: 开发特殊的认证插件,让您能够选择IP的用户可以登录。
方法3: 修改Redmine的核心文件和数据库或通过修改/mode/user.rb文件创建包含用户批准IP地址或范围的自定义字段
所以你应该添加如下内容:
return nil unless IPAddr.new(user.permitted_ip).include? request.env['HTTP_X_REAL_IP'] || request.env['REMOTE_ADDR']
后
# Returns the user that matches provided login and password, or nil
def self.try_to_login(login, password, active_only=true)
login = login.to_s.strip
password = password.to_s
# Make sure no one can sign in with an empty login or password
return nil if login.empty? || password.empty?
user = find_by_login(login)
if user
# user is already in local database
return nil unless user.check_password?(password)
return nil if !user.active? && active_only
(如果您不使用外部身份验证源,上面的代码应该可以工作)
推荐阅读
- kubernetes - 对于 pod 到 pod 的通信,应该使用什么 IP?服务的 ClusterIP 或端点
- sql - XP_CMDSHELL 不时无缘无故地被禁用
- c# - 在 vb.net 中使用 HttpWebRequest 代理
- spring - 基于 Spring Cloud 微服务与 Zuul 的 Spring CORS 过滤器问题
- reactjs - react-router 中的路由不匹配
- angular - Angular 5 想要从 ngx-bootstrap 模式获取价值到组件
- c# - 如何在 wix 安装程序的设置对话框中上传图像?
- visual-studio-code - 在 Azure Pipeline 上找不到 VS 代码扩展测试
- regex - 忽略空行 [\t\s] 空格或制表符
- html - 创建css聊天气泡时可见线