朋友,
有没有一种方法,我们可以允许一组用户从任何IP访问redmine,而其他用户仅从一组IP登录
请帮助
谢谢
Abhishek
当前(Redmine 4.1)尚无此功能,但是它是开源软件,欢迎您在their tracker上请求该功能或开发自己的代码。因此,如果您快速需要解决方案,则有几种选择:
方法1:您可以通过让远程用户通过VPN连接来解决此问题,这将使他们具有给定IP组中的IP。
方法2:开发特殊的身份验证插件,使您能够选择从哪个IP用户可以登录。
方法3:通过修改/mode/user.rb文件,修改Redmine的核心文件和数据库,或创建包含用户批准的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
(如果您不使用外部身份验证源,则上面的代码应该可以工作)