diff --git a/app/models/redmine/api.rb b/app/models/redmine/api.rb new file mode 100644 index 000000000..bf7f68a5e --- /dev/null +++ b/app/models/redmine/api.rb @@ -0,0 +1,118 @@ +class Redmine::API < Tracker::RemoteAPI + + def self.generate_base_url(tracker_url) + tracker_url.gsub(/\/issues\/\d+/, '/') + end + + def self.generate_issue_list_path(params = {}) + "issues?" + params.to_param + end + + def self.needs_html_to_extract? + true + end + + def self.extract_info_from_url(url, html) + return nil unless html.match(/redmine/) + + issue_match = url.match('/issues/(\d+)') + if issue_match + issue_number = issue_match[1] + + doc = Nokogiri::HTML(html) + issue_title = doc.css('subject h3').text.strip + + tracker_url = url.gsub(issue_match[0], '') + + tracker_name = doc.css('head > title').text.gsub(/(.*? - )/, '') + + { + issue_url: url, + issue_number: issue_number, + issue_title: issue_title, + issue_class: Redmine::Issue, + tracker_url: tracker_url, + tracker_name: tracker_name, + tracker_class: Redmine::Tracker + } + end + end + + def self.parse_single_issue(response = "") + doc = Nokogiri::HTML(response) + + number = doc.css('#content > h2').text.strip.gsub(/[^\d]/, '') + title = doc.css('head > title').text.strip + body = doc.css('.description > .wiki').text.strip + state = doc.css('.status.attribute .value').text.strip.downcase + author_name = doc.css('.issue .author .user.active').text.strip + + owner = doc.css('.assigned-to .value').text.strip + owner = (owner.present? and owner != '-' ? owner : nil) +#binding.pry + remote_created_at = doc.css('.issue .author a[2]').first['title'].strip + remote_updated_at = doc.css('.issue .author a[3]').first['title'].strip + remote_type = nil + can_add_bounty = status_to_can_add_bounty(state) + priority = doc.css('.priority.attribute .value').text.strip.capitalize + severity = nil + votes_count = nil + + comments = [] + doc.css('#history .journal:not(.has-details)').each do |comment| + remote_id = comment.css('.journal-link').text.strip.gsub(/[^\d]/, '').to_i + body_html = comment.css('.wiki').text.strip + created_at = comment.css('h4 a[4]').first[:title].strip + comment_author_name = comment.css('.user.active').text.strip + + comments << { + remote_id: remote_id, + body_html: body_html, + created_at: created_at, + author_name: comment_author_name + } + end + + { + number: number, + title: title, + body: body, + state: state, + author_name: author_name, + owner: owner, + remote_created_at: remote_created_at, + remote_updated_at: remote_updated_at, + remote_type: remote_type, + can_add_bounty: can_add_bounty, + priority: priority, + severity: severity, + votes_count: votes_count, + comments: comments + } + end + + def self.parse_issue_list(base_url, response = "") + results = [] + doc = Nokogiri::HTML(response) + doc.css('.issue').each do |issue| + id = issue.css('.id a').first.text.strip + state = issue.css('.status').first.text.downcase + results << { + number: id.to_i, + title: issue.css('.subject a').first.text.strip, + state: state, + url: File.join(base_url, 'issues/' + id), + can_add_bounty: status_to_can_add_bounty(state), + severity: nil, + priority: issue.css('.priority').first.text.strip + } + end + results + end + + private + + def self.status_to_can_add_bounty(status) + ['new', 'assigned', 'pending', 'need more information', 'needs design'].include?(status) + end +end diff --git a/app/models/redmine/issue.rb b/app/models/redmine/issue.rb new file mode 100644 index 000000000..ad9720b57 --- /dev/null +++ b/app/models/redmine/issue.rb @@ -0,0 +1,19 @@ +class Redmine::Issue < ::Issue + belongs_to :tracker, class_name: 'Redmine::Tracker', foreign_key: :tracker_id + + def remote_sync_if_necessary(options={}) + remote_sync(options) if synced_at.nil? || synced_at < 1.day.ago + end + + def remote_sync(options={}) + update_attributes!(synced_at: Time.now) unless new_record? + api_response = Redmine::API.fetch_issue(url: self.url) + + ApplicationRecord.transaction do + comments_info = api_response.delete(:comments) + api_response.merge!(synced_at: Time.now) + update_attributes!(api_response) + sync_comments_from_array(comments_info) + end + end +end diff --git a/app/models/redmine/tracker.rb b/app/models/redmine/tracker.rb new file mode 100644 index 000000000..5b3ab0e99 --- /dev/null +++ b/app/models/redmine/tracker.rb @@ -0,0 +1,26 @@ +class Redmine::Tracker < ::Tracker + has_many :issues, class_name: "Redmine::Issue", foreign_key: :tracker_id + + def remote_sync_if_necessary(options={}) + if synced_at.nil? + remote_sync(options) + elsif synced_at < 1.hour.ago + delay.remote_sync(options) + end + end + + def remote_sync(options={}) + update_attributes synced_at: Time.now + params = { + sort: 'priority:desc,id:desc', + v: { status_id: [1, 2, 8, 9, 11] }, + per_page: 100 + } + api_options = { + url: Redmine::API.generate_base_url(self.url), + path: Redmine::API.generate_issue_list_path(params) + } + api_response = Redmine::API.fetch_issue_list(api_options) + sync_issues_from_array(api_response) + end +end diff --git a/app/models/tracker.rb b/app/models/tracker.rb index d9e7388d8..e31f6e5ae 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -71,6 +71,7 @@ class Tracker < ApplicationRecord Savannah::API Mantis::API Gitlab::API + Redmine::API ) STATIC_SUBCLASSNAMES = %w( @@ -87,6 +88,7 @@ class Tracker < ApplicationRecord Savannah::Tracker Mantis::Tracker Gitlab::Tracker + Redmine::Tracker ) class RemoteAPI diff --git a/spec/factories/issue.rb b/spec/factories/issue.rb index 9ff23dff7..0f239e5ce 100644 --- a/spec/factories/issue.rb +++ b/spec/factories/issue.rb @@ -34,6 +34,10 @@ association :tracker, factory: :bugzilla_tracker end + factory :redmine_issue, class: Redmine::Issue do + association :tracker, factory: :redmine_tracker + end + factory :gitlab, class: Gitlab::Issue do association :tracker, factory: :gitlab_tracker end diff --git a/spec/factories/trackers.rb b/spec/factories/trackers.rb index 133ba4cb5..42c2faedc 100644 --- a/spec/factories/trackers.rb +++ b/spec/factories/trackers.rb @@ -82,6 +82,11 @@ sequence(:url) { |n| "https://www.randomsite-#{n}.local/bugs/buglist.cgi?product=abc" } end + factory :redmine_tracker, class: Redmine::Tracker do + sequence(:name) { |n| "Redmine repo #{n}" } + sequence(:url) { |n| "https://www.randomsite.local/issues" } + end + factory :sourceforge_tracker, class: SourceForge::Tracker do sequence(:name) { |n| "SourceForge#{n}" } sequence(:url) { |n| "http://sourceforge.net/projects/sourceforge#{n}/" } diff --git a/spec/models/redmine/issue_spec.rb b/spec/models/redmine/issue_spec.rb new file mode 100644 index 000000000..028a2787c --- /dev/null +++ b/spec/models/redmine/issue_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe Redmine::Issue do + + describe '.remote_sync' do + let(:redmine_issue) { create(:redmine_issue) } + let(:data) do + { + number: 123, + title: 'title', + state: 'open', + priority: 'high', + comments: [] + } + end + before do + expect(Redmine::API).to receive(:fetch_issue).and_return(data) + end + it "should call api and set issue attributes as api returned" do + expect(redmine_issue.remote_sync).to be_truthy + expect(redmine_issue.title).to eq('title') + end + end +end diff --git a/spec/models/redmine/tracker_spec.rb b/spec/models/redmine/tracker_spec.rb new file mode 100644 index 000000000..4630e7f19 --- /dev/null +++ b/spec/models/redmine/tracker_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe Redmine::Tracker do + + describe '.remote_sync' do + let(:tracker) { create(:redmine_tracker) } + let(:data) do + [{ + number: 123, + title: 'title', + state: 'open', + priority: 'high', + url: "#{tracker.url}/issues/123" + }] + end + before do + expect(Redmine::API).to receive(:fetch_issue_list).and_return(data) + end + it "should call api and set issue attributes as api returned" do + tracker.remote_sync + expect(tracker.issues.count).to eq(1) + issue = tracker.issues.first + expect(issue.title).to eq('title') + end + end +end diff --git a/spec/trackers/all_spec.rb b/spec/trackers/all_spec.rb index 05854510b..0997643a0 100644 --- a/spec/trackers/all_spec.rb +++ b/spec/trackers/all_spec.rb @@ -172,6 +172,18 @@ expect(action).to change(Comment, :count).by_at_least(1) end end + + describe "Redmine::Issue" do + let(:issue_url) { "https://projects.theforeman.org/issues/863" } + + it "should create new issue" do + expect(action).to change(Issue, :count).by(1) + end + + it "should fetch issue comment" do + expect(action).to change(Comment, :count).by_at_least(1) + end + end end describe "Tracker#remote_sync" do diff --git a/spec/vcr/live_sync/issue_remote_sync_redmine/issue_should_create_new_issue.yml b/spec/vcr/live_sync/issue_remote_sync_redmine/issue_should_create_new_issue.yml new file mode 100644 index 000000000..c90f0d3d5 --- /dev/null +++ b/spec/vcr/live_sync/issue_remote_sync_redmine/issue_should_create_new_issue.yml @@ -0,0 +1,668 @@ +--- +http_interactions: +- request: + method: get + uri: https://gitlab.com/api/v4/projects/https:%2F%2Fprojects.theforeman.org%2Fissues%2F863 + body: + encoding: US-ASCII + string: '' + headers: {} + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sat, 01 Sep 2018 20:11:29 GMT + Content-Type: + - application/json + Content-Length: + - '35' + Cache-Control: + - no-cache + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Request-Id: + - b4f0231e-d0c2-4475-88f3-95e9e0aac524 + X-Runtime: + - '0.019036' + Ratelimit-Limit: + - '600' + Ratelimit-Observed: + - '1' + Ratelimit-Remaining: + - '599' + Ratelimit-Reset: + - '1535832749' + Ratelimit-Resettime: + - Sun, 01 Sep 2018 20:12:29 GMT + body: + encoding: UTF-8 + string: '{"message":"404 Project Not Found"}' + http_version: + recorded_at: Sat, 01 Sep 2018 20:11:30 GMT +- request: + method: get + uri: https://projects.theforeman.org/issues/863 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/35.0.1916.153 Safari/537.36 + response: + status: + code: 200 + message: OK + headers: + Date: + - Sat, 01 Sep 2018 20:16:05 GMT + Server: + - Apache/2.4.6 (CentOS) + Cache-Control: + - max-age=0, private, must-revalidate + X-Xss-Protection: + - 1; mode=block + X-Request-Id: + - 7100f6ce-d4fe-4c88-9d93-0e7f4a3625b2 + X-Frame-Options: + - SAMEORIGIN + X-Runtime: + - '0.431175' + X-Content-Type-Options: + - nosniff + X-Powered-By: + - Phusion Passenger 5.3.3 + Set-Cookie: + - _redmine_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTA3MWVmY2ZkNzg1NTQzNjA5NjczNjhjNDM0NGYzNDdkBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUhQRzlndVZYRHJnWE8rMHQzNHBSVEI3ZXd0RzlBNVkwa2NuU3BBNHhtUVE9BjsARg%3D%3D--3366193db95c2d1baded70b7e27cee7a932558fb; + path=/; HttpOnly + Etag: + - W/"25a6d4023131c8788b1d95c1b747e176" + Status: + - 200 OK + Vary: + - Accept-Encoding + Strict-Transport-Security: + - max-age=15778800; + Transfer-Encoding: + - chunked + Content-Type: + - text/html; charset=utf-8 + body: + encoding: UTF-8 + string: "\n\n\n\n\nFeature + #863: add ability to restrict ldap authentication to a security group - Foreman\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n \n\n \n\n\n\n
\n\n
\n\n\n + \
\n
\n \n \n \n
\n\n\n

Project

\n \n\n + \

General

\n \n\n \n\n

Profile

\n + \ \n\n
\n\n
\n
\n\n\n
\n\n \n\n + \
\n
\n \n \n \n \n
\n
\n\n

\n \"Foremanlogo\"\n + \ \n

\n\n \n
\n\n
\n \n\n
\n \n
\n\n\n\n\n\n
\n\n\n

Feature + #863

\n\n
\n\n
\n \"\"\n \n
\n\n
\n

add ability to restrict + ldap authentication to a security group

\n
\n

\n + \ Added by Corey Osman + over + 7 years ago.\n Updated about + 5 years ago.\n

\n\n
\n
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Authentication
Target version:
\n
Difficulty:
Triaged:
No
Bugzilla + link:
Pull request:
Team + Backlog:
Fixed + in Releases:
Found in Releases:
\n \n\n\n\n\n \n\n
\n\n
\n
\n
\n \n
\n\n + \

Description

\n
\n

I would + like to be able to specify ldap authentication to only do name lookups by + a specific group:

\n\n\n\t

example:

\n\n\n\t

can I restrict by group + like this : cn=foremanadmins, ou=Security Groups, dc=MYDOMAIN,dc=CORP

\n\n\n\t

I + currently have this enabled with my subversion setup so I was hoping I could + do it on foreman as well.

\n
\n
\n\n\n\n\n\n\n\n
\n
\n
\n
\n\n

Related + issues

\n\n
\n
Related to Foreman - Feature + #813: Support AD group membership for authorization and authenticationClosed2011-03-31
\n
\n
\n\n\n

\nIssue #\n\nDelay: + days\n\n\nCancel\n

\n\n\n\n\n\n
\n
\n\n
\n\n
\n

Associated revisions

\n
\n + \

Revision + 4e4671ce\n (diff)\n + \
\n Added by Nils Domrose about + 5 years ago

\n
\n + \

fixes #863 - added ldap_filter + to LDAP auth sources to filter lookups using RFC 2254 filters

\n
\n + \
\n\n
\n\n
\n

History

\n
\n
\n

#1\n \"\"\n Updated by Benjamin Papillon + almost + 7 years ago\n

\n\n + \

And also important, affect + role based on LDAP group.
If it's possible to create a LDAP Group type,(auto + create user option enabled) then when the user from a group connect for the + first time, the good role is automatically assigned.

\n
\n + \
\n \n
\n
\n

#2\n + \ \"\"\n Updated by monte olvera + almost + 7 years ago\n

\n\n + \

I would also like to + have ldap auth restricted to members of an ldap group.

\n
\n + \
\n \n
\n
\n

#3\n + \ \"\"\n Updated by Karl Vollmer + over + 5 years ago\n

\n\n + \

I need this for work, + so I put $100 down for anyone who will complete this functionality.

\n\n\n\t

https://www.bountysource.com/#issues/116703-add-ability-to-restrict-ldap-authentication-to-a-security-group

\n + \
\n
\n \n
\n + \
\n

#4\n + \ \"\"\n Updated by Mikael Fridh + over + 5 years ago\n

\n\n + \

just a bit of a pseudo-code + version of doing it (untested): https://github.com/frimik/foreman/compare/863-ldap_group_restriction

\n\n\n\t

The + actual search method code was tested against Active Directory before + I hackishly put this example in the Foreman code though as I recently built + some puppet functions to get canonical user and group information from Active + Directory with net-ldap.

\n\n\n\t

Perhaps it can inspire someone to clean + it up, make it work and add it as a configuration setting?

\n
\n + \
\n \n
\n
\n

#5\n + \ \"\"\n Updated by Nils Domrose + about + 5 years ago\n

\n\n + \ \n + \
\n
\n \n
\n + \
\n

#6\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Description updated + (diff)
  • \n + \
  • Category set to Authentication
  • \n
  • Status + changed from New to Ready For Testing
  • \n
\n \n + \
\n
\n \n
\n + \
\n

#7\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Target version set + to 1.3.0
  • \n
\n \n
\n
\n \n
\n
\n

#8\n \"\"\n Updated by Anonymous about 5 years + ago\n

\n\n + \
    \n
  • Status changed from + Ready For Testing to Closed
  • \n
  • % Done + changed from 0 to 100
  • \n
\n \n + \
\n
\n \n\n\n
\n\n\n
\n
\n\n\n\n\n\n
\n\n\n
\n\n

Also available in: Atom\n PDF\n

\n\n\n\n\n\n \n
\n
\n
\n
\n\n
Loading...
\n
\n\n
\n
\n Powered by Redmine + © 2006-2018 Jean-Philippe Lang\n
\n
\n
\n
\n\n\n\n" + http_version: + recorded_at: Sat, 01 Sep 2018 20:16:06 GMT +- request: + method: get + uri: https://projects.theforeman.org/issues/863 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/35.0.1916.153 Safari/537.36 + response: + status: + code: 200 + message: OK + headers: + Date: + - Sun, 02 Sep 2018 17:31:45 GMT + Server: + - Apache/2.4.6 (CentOS) + Cache-Control: + - max-age=0, private, must-revalidate + X-Xss-Protection: + - 1; mode=block + X-Request-Id: + - 7c998e83-d449-46f8-aafa-b20c5a4d3707 + X-Frame-Options: + - SAMEORIGIN + X-Runtime: + - '0.356213' + X-Content-Type-Options: + - nosniff + X-Powered-By: + - Phusion Passenger 5.3.3 + Set-Cookie: + - _redmine_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTc5MjE5ZjIxZmQ5NmVmMDJjY2IzNGM5YzkxMjJiNGE3BjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMXVqSitxbHJhRE11VG9UVEFGQUduSHhUcURrS3NKM29VV0R6bjNyYWlxOWs9BjsARg%3D%3D--63d5b425a05de261638e4cf777fab4cf54b2d5e7; + path=/; HttpOnly + Etag: + - W/"7247bacdc7a260acc44df13030b3b55b" + Status: + - 200 OK + Vary: + - Accept-Encoding + Strict-Transport-Security: + - max-age=15778800; + Transfer-Encoding: + - chunked + Content-Type: + - text/html; charset=utf-8 + body: + encoding: UTF-8 + string: "\n\n\n\n\nFeature + #863: add ability to restrict ldap authentication to a security group - Foreman\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n \n\n \n\n\n\n
\n\n
\n\n\n + \
\n
\n \n \n \n
\n\n\n

Project

\n \n\n + \

General

\n \n\n \n\n

Profile

\n + \ \n\n
\n\n
\n
\n\n\n
\n\n \n\n + \
\n
\n \n \n \n \n
\n
\n\n

\n \"Foremanlogo\"\n + \ \n

\n\n \n
\n\n
\n \n\n
\n \n
\n\n\n\n\n\n
\n\n\n

Feature + #863

\n\n
\n\n
\n \"\"\n \n
\n\n
\n

add ability to restrict + ldap authentication to a security group

\n
\n

\n + \ Added by Corey Osman + over + 7 years ago.\n Updated about + 5 years ago.\n

\n\n
\n
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Authentication
Target version:
\n
Difficulty:
Triaged:
No
Bugzilla + link:
Pull request:
Team + Backlog:
Fixed + in Releases:
Found in Releases:
\n \n\n\n\n\n \n\n
\n\n
\n
\n
\n \n
\n\n + \

Description

\n
\n

I would + like to be able to specify ldap authentication to only do name lookups by + a specific group:

\n\n\n\t

example:

\n\n\n\t

can I restrict by group + like this : cn=foremanadmins, ou=Security Groups, dc=MYDOMAIN,dc=CORP

\n\n\n\t

I + currently have this enabled with my subversion setup so I was hoping I could + do it on foreman as well.

\n
\n
\n\n\n\n\n\n\n\n
\n
\n
\n
\n\n

Related + issues

\n\n
\n
Related to Foreman - Feature + #813: Support AD group membership for authorization and authenticationClosed2011-03-31
\n
\n
\n\n\n

\nIssue #\n\nDelay: + days\n\n\nCancel\n

\n\n\n\n\n\n
\n
\n\n
\n\n
\n

Associated revisions

\n
\n + \

Revision + 4e4671ce\n (diff)\n + \
\n Added by Nils Domrose about + 5 years ago

\n
\n + \

fixes #863 - added ldap_filter + to LDAP auth sources to filter lookups using RFC 2254 filters

\n
\n + \
\n\n
\n\n
\n

History

\n
\n
\n

#1\n \"\"\n Updated by Benjamin Papillon + almost + 7 years ago\n

\n\n + \

And also important, affect + role based on LDAP group.
If it's possible to create a LDAP Group type,(auto + create user option enabled) then when the user from a group connect for the + first time, the good role is automatically assigned.

\n
\n + \
\n \n
\n
\n

#2\n + \ \"\"\n Updated by monte olvera + almost + 7 years ago\n

\n\n + \

I would also like to + have ldap auth restricted to members of an ldap group.

\n
\n + \
\n \n
\n
\n

#3\n + \ \"\"\n Updated by Karl Vollmer + over + 5 years ago\n

\n\n + \

I need this for work, + so I put $100 down for anyone who will complete this functionality.

\n\n\n\t

https://www.bountysource.com/#issues/116703-add-ability-to-restrict-ldap-authentication-to-a-security-group

\n + \
\n
\n \n
\n + \
\n

#4\n + \ \"\"\n Updated by Mikael Fridh + over + 5 years ago\n

\n\n + \

just a bit of a pseudo-code + version of doing it (untested): https://github.com/frimik/foreman/compare/863-ldap_group_restriction

\n\n\n\t

The + actual search method code was tested against Active Directory before + I hackishly put this example in the Foreman code though as I recently built + some puppet functions to get canonical user and group information from Active + Directory with net-ldap.

\n\n\n\t

Perhaps it can inspire someone to clean + it up, make it work and add it as a configuration setting?

\n
\n + \
\n \n
\n
\n

#5\n + \ \"\"\n Updated by Nils Domrose + about + 5 years ago\n

\n\n + \ \n + \
\n
\n \n
\n + \
\n

#6\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Description updated + (diff)
  • \n + \
  • Category set to Authentication
  • \n
  • Status + changed from New to Ready For Testing
  • \n
\n \n + \
\n
\n \n
\n + \
\n

#7\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Target version set + to 1.3.0
  • \n
\n \n
\n
\n \n
\n
\n

#8\n \"\"\n Updated by Anonymous about 5 years + ago\n

\n\n + \
    \n
  • Status changed from + Ready For Testing to Closed
  • \n
  • % Done + changed from 0 to 100
  • \n
\n \n + \
\n
\n \n\n\n
\n\n\n
\n
\n\n\n\n\n\n
\n\n\n
\n\n

Also available in: Atom\n PDF\n

\n\n\n\n\n\n \n
\n
\n
\n
\n\n
Loading...
\n
\n\n
\n
\n Powered by Redmine + © 2006-2018 Jean-Philippe Lang\n
\n
\n
\n
\n\n\n\n" + http_version: + recorded_at: Sun, 02 Sep 2018 17:32:01 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/vcr/live_sync/issue_remote_sync_redmine/issue_should_fetch_issue_comment.yml b/spec/vcr/live_sync/issue_remote_sync_redmine/issue_should_fetch_issue_comment.yml new file mode 100644 index 000000000..28580d12f --- /dev/null +++ b/spec/vcr/live_sync/issue_remote_sync_redmine/issue_should_fetch_issue_comment.yml @@ -0,0 +1,668 @@ +--- +http_interactions: +- request: + method: get + uri: https://gitlab.com/api/v4/projects/https:%2F%2Fprojects.theforeman.org%2Fissues%2F863 + body: + encoding: US-ASCII + string: '' + headers: {} + response: + status: + code: 404 + message: Not Found + headers: + Server: + - nginx + Date: + - Sat, 01 Sep 2018 20:11:36 GMT + Content-Type: + - application/json + Content-Length: + - '35' + Cache-Control: + - no-cache + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Request-Id: + - 162c4b3b-2049-4bd5-a035-7b47eb4b2cc2 + X-Runtime: + - '0.020080' + Ratelimit-Limit: + - '600' + Ratelimit-Observed: + - '2' + Ratelimit-Remaining: + - '598' + Ratelimit-Reset: + - '1535832756' + Ratelimit-Resettime: + - Sun, 01 Sep 2018 20:12:36 GMT + body: + encoding: UTF-8 + string: '{"message":"404 Project Not Found"}' + http_version: + recorded_at: Sat, 01 Sep 2018 20:11:36 GMT +- request: + method: get + uri: https://projects.theforeman.org/issues/863 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/35.0.1916.153 Safari/537.36 + response: + status: + code: 200 + message: OK + headers: + Date: + - Sat, 01 Sep 2018 20:11:37 GMT + Server: + - Apache/2.4.6 (CentOS) + Cache-Control: + - max-age=0, private, must-revalidate + X-Xss-Protection: + - 1; mode=block + X-Request-Id: + - 65059ab8-a871-4d7f-89c5-5830614870c8 + X-Frame-Options: + - SAMEORIGIN + X-Runtime: + - '0.362104' + X-Content-Type-Options: + - nosniff + X-Powered-By: + - Phusion Passenger 5.3.3 + Set-Cookie: + - _redmine_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTAxYmE5NTMyMDdlZGViMDNiNjg4ZjQxYzk1M2I3MjYwBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUFnZDFqZGtud2tJU0VqM1ZFbWpjS2p5LzBrUnhuejJ4UlFyTDdManZ6YUk9BjsARg%3D%3D--957e4e02de082b9db47acf58c8e745464d53a339; + path=/; HttpOnly + Etag: + - W/"8cacf6e9d48772845795e9986e2a8eef" + Status: + - 200 OK + Vary: + - Accept-Encoding + Strict-Transport-Security: + - max-age=15778800; + Transfer-Encoding: + - chunked + Content-Type: + - text/html; charset=utf-8 + body: + encoding: UTF-8 + string: "\n\n\n\n\nFeature + #863: add ability to restrict ldap authentication to a security group - Foreman\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n \n\n \n\n\n\n
\n\n
\n\n\n + \
\n
\n \n \n \n
\n\n\n

Project

\n \n\n + \

General

\n \n\n \n\n

Profile

\n + \ \n\n
\n\n
\n
\n\n\n
\n\n \n\n + \
\n
\n \n \n \n \n
\n
\n\n

\n \"Foremanlogo\"\n + \ \n

\n\n \n
\n\n
\n \n\n
\n \n
\n\n\n\n\n\n
\n\n\n

Feature + #863

\n\n
\n\n
\n \"\"\n \n
\n\n
\n

add ability to restrict + ldap authentication to a security group

\n
\n

\n + \ Added by Corey Osman + over + 7 years ago.\n Updated about + 5 years ago.\n

\n\n
\n
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Authentication
Target version:
\n
Difficulty:
Triaged:
No
Bugzilla + link:
Pull request:
Team + Backlog:
Fixed + in Releases:
Found in Releases:
\n \n\n\n\n\n \n\n
\n\n
\n
\n
\n \n
\n\n + \

Description

\n
\n

I would + like to be able to specify ldap authentication to only do name lookups by + a specific group:

\n\n\n\t

example:

\n\n\n\t

can I restrict by group + like this : cn=foremanadmins, ou=Security Groups, dc=MYDOMAIN,dc=CORP

\n\n\n\t

I + currently have this enabled with my subversion setup so I was hoping I could + do it on foreman as well.

\n
\n
\n\n\n\n\n\n\n\n
\n
\n
\n
\n\n

Related + issues

\n\n
\n
Related to Foreman - Feature + #813: Support AD group membership for authorization and authenticationClosed2011-03-31
\n
\n
\n\n\n

\nIssue #\n\nDelay: + days\n\n\nCancel\n

\n\n\n\n\n\n
\n
\n\n
\n\n
\n

Associated revisions

\n
\n + \

Revision + 4e4671ce\n (diff)\n + \
\n Added by Nils Domrose about + 5 years ago

\n
\n + \

fixes #863 - added ldap_filter + to LDAP auth sources to filter lookups using RFC 2254 filters

\n
\n + \
\n\n
\n\n
\n

History

\n
\n
\n

#1\n \"\"\n Updated by Benjamin Papillon + almost + 7 years ago\n

\n\n + \

And also important, affect + role based on LDAP group.
If it's possible to create a LDAP Group type,(auto + create user option enabled) then when the user from a group connect for the + first time, the good role is automatically assigned.

\n
\n + \
\n \n
\n
\n

#2\n + \ \"\"\n Updated by monte olvera + almost + 7 years ago\n

\n\n + \

I would also like to + have ldap auth restricted to members of an ldap group.

\n
\n + \
\n \n
\n
\n

#3\n + \ \"\"\n Updated by Karl Vollmer + over + 5 years ago\n

\n\n + \

I need this for work, + so I put $100 down for anyone who will complete this functionality.

\n\n\n\t

https://www.bountysource.com/#issues/116703-add-ability-to-restrict-ldap-authentication-to-a-security-group

\n + \
\n
\n \n
\n + \
\n

#4\n + \ \"\"\n Updated by Mikael Fridh + over + 5 years ago\n

\n\n + \

just a bit of a pseudo-code + version of doing it (untested): https://github.com/frimik/foreman/compare/863-ldap_group_restriction

\n\n\n\t

The + actual search method code was tested against Active Directory before + I hackishly put this example in the Foreman code though as I recently built + some puppet functions to get canonical user and group information from Active + Directory with net-ldap.

\n\n\n\t

Perhaps it can inspire someone to clean + it up, make it work and add it as a configuration setting?

\n
\n + \
\n \n
\n
\n

#5\n + \ \"\"\n Updated by Nils Domrose + about + 5 years ago\n

\n\n + \ \n + \
\n
\n \n
\n + \
\n

#6\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Description updated + (diff)
  • \n + \
  • Category set to Authentication
  • \n
  • Status + changed from New to Ready For Testing
  • \n
\n \n + \
\n
\n \n
\n + \
\n

#7\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Target version set + to 1.3.0
  • \n
\n \n
\n
\n \n
\n
\n

#8\n \"\"\n Updated by Anonymous about 5 years + ago\n

\n\n + \
    \n
  • Status changed from + Ready For Testing to Closed
  • \n
  • % Done + changed from 0 to 100
  • \n
\n \n + \
\n
\n \n\n\n
\n\n\n
\n
\n\n\n\n\n\n
\n\n\n
\n\n

Also available in: Atom\n PDF\n

\n\n\n\n\n\n \n
\n
\n
\n
\n\n
Loading...
\n
\n\n
\n
\n Powered by Redmine + © 2006-2018 Jean-Philippe Lang\n
\n
\n
\n
\n\n\n\n" + http_version: + recorded_at: Sat, 01 Sep 2018 20:11:38 GMT +- request: + method: get + uri: https://projects.theforeman.org/issues/863 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/35.0.1916.153 Safari/537.36 + response: + status: + code: 200 + message: OK + headers: + Date: + - Sun, 02 Sep 2018 17:32:02 GMT + Server: + - Apache/2.4.6 (CentOS) + Cache-Control: + - max-age=0, private, must-revalidate + X-Xss-Protection: + - 1; mode=block + X-Request-Id: + - 3033298a-fa1a-48ed-8039-6b3ae50453dc + X-Frame-Options: + - SAMEORIGIN + X-Runtime: + - '0.787780' + X-Content-Type-Options: + - nosniff + X-Powered-By: + - Phusion Passenger 5.3.3 + Set-Cookie: + - _redmine_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTk3Y2NiMDgyOWRmYjdiNjFlMjA5OTMxMmEyMTk1YmRmBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMU1WNVpoay8zSXFLc3ZCSXd5Y3NmZlhLcXlBWUQxN0dHY1pYRmF3eTU3bEE9BjsARg%3D%3D--9c6754a8101667601324e7f623d9c3cc8cc11e95; + path=/; HttpOnly + Etag: + - W/"faf49b7e936cca9e70752affd1e787c7" + Status: + - 200 OK + Vary: + - Accept-Encoding + Strict-Transport-Security: + - max-age=15778800; + Transfer-Encoding: + - chunked + Content-Type: + - text/html; charset=utf-8 + body: + encoding: UTF-8 + string: "\n\n\n\n\nFeature + #863: add ability to restrict ldap authentication to a security group - Foreman\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n \n\n \n\n\n\n
\n\n
\n\n\n + \
\n
\n \n \n \n
\n\n\n

Project

\n \n\n + \

General

\n \n\n \n\n

Profile

\n + \ \n\n
\n\n
\n
\n\n\n
\n\n \n\n + \
\n
\n \n \n \n \n
\n
\n\n

\n \"Foremanlogo\"\n + \ \n

\n\n \n
\n\n
\n \n\n
\n \n
\n\n\n\n\n\n
\n\n\n

Feature + #863

\n\n
\n\n
\n \"\"\n \n
\n\n
\n

add ability to restrict + ldap authentication to a security group

\n
\n

\n + \ Added by Corey Osman + over + 7 years ago.\n Updated about + 5 years ago.\n

\n\n
\n
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Authentication
Target version:
\n
Difficulty:
Triaged:
No
Bugzilla + link:
Pull request:
Team + Backlog:
Fixed + in Releases:
Found in Releases:
\n \n\n\n\n\n \n\n
\n\n
\n
\n
\n \n
\n\n + \

Description

\n
\n

I would + like to be able to specify ldap authentication to only do name lookups by + a specific group:

\n\n\n\t

example:

\n\n\n\t

can I restrict by group + like this : cn=foremanadmins, ou=Security Groups, dc=MYDOMAIN,dc=CORP

\n\n\n\t

I + currently have this enabled with my subversion setup so I was hoping I could + do it on foreman as well.

\n
\n
\n\n\n\n\n\n\n\n
\n
\n
\n
\n\n

Related + issues

\n\n
\n
Related to Foreman - Feature + #813: Support AD group membership for authorization and authenticationClosed2011-03-31
\n
\n
\n\n\n

\nIssue #\n\nDelay: + days\n\n\nCancel\n

\n\n\n\n\n\n
\n
\n\n
\n\n
\n

Associated revisions

\n
\n + \

Revision + 4e4671ce\n (diff)\n + \
\n Added by Nils Domrose about + 5 years ago

\n
\n + \

fixes #863 - added ldap_filter + to LDAP auth sources to filter lookups using RFC 2254 filters

\n
\n + \
\n\n
\n\n
\n

History

\n
\n
\n

#1\n \"\"\n Updated by Benjamin Papillon + almost + 7 years ago\n

\n\n + \

And also important, affect + role based on LDAP group.
If it's possible to create a LDAP Group type,(auto + create user option enabled) then when the user from a group connect for the + first time, the good role is automatically assigned.

\n
\n + \
\n \n
\n
\n

#2\n + \ \"\"\n Updated by monte olvera + almost + 7 years ago\n

\n\n + \

I would also like to + have ldap auth restricted to members of an ldap group.

\n
\n + \
\n \n
\n
\n

#3\n + \ \"\"\n Updated by Karl Vollmer + over + 5 years ago\n

\n\n + \

I need this for work, + so I put $100 down for anyone who will complete this functionality.

\n\n\n\t

https://www.bountysource.com/#issues/116703-add-ability-to-restrict-ldap-authentication-to-a-security-group

\n + \
\n
\n \n
\n + \
\n

#4\n + \ \"\"\n Updated by Mikael Fridh + over + 5 years ago\n

\n\n + \

just a bit of a pseudo-code + version of doing it (untested): https://github.com/frimik/foreman/compare/863-ldap_group_restriction

\n\n\n\t

The + actual search method code was tested against Active Directory before + I hackishly put this example in the Foreman code though as I recently built + some puppet functions to get canonical user and group information from Active + Directory with net-ldap.

\n\n\n\t

Perhaps it can inspire someone to clean + it up, make it work and add it as a configuration setting?

\n
\n + \
\n \n
\n
\n

#5\n + \ \"\"\n Updated by Nils Domrose + about + 5 years ago\n

\n\n + \ \n + \
\n
\n \n
\n + \
\n

#6\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Description updated + (diff)
  • \n + \
  • Category set to Authentication
  • \n
  • Status + changed from New to Ready For Testing
  • \n
\n \n + \
\n
\n \n
\n + \
\n

#7\n + \ \"\"\n Updated by Dominic Cleal + about + 5 years ago\n

\n\n + \
    \n
  • Target version set + to 1.3.0
  • \n
\n \n
\n
\n \n
\n
\n

#8\n \"\"\n Updated by Anonymous about 5 years + ago\n

\n\n + \
    \n
  • Status changed from + Ready For Testing to Closed
  • \n
  • % Done + changed from 0 to 100
  • \n
\n \n + \
\n
\n \n\n\n
\n\n\n
\n
\n\n\n\n\n\n
\n\n\n
\n\n

Also available in: Atom\n PDF\n

\n\n\n\n\n\n \n
\n
\n
\n
\n\n
Loading...
\n
\n\n
\n
\n Powered by Redmine + © 2006-2018 Jean-Philippe Lang\n
\n
\n
\n
\n\n\n\n" + http_version: + recorded_at: Sun, 02 Sep 2018 17:32:04 GMT +recorded_with: VCR 4.0.0