Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
452a920
Adding auth sources
bradly Nov 9, 2010
072dd0b
Adding roles and the ability to assign users to projects
bradly Nov 10, 2010
354153d
Adding the ability to edit users from the projects page.
bradly Nov 10, 2010
6e03f6c
Added on the fly registration for LDAP.
bradly Nov 11, 2010
3400fd9
Tweaks to get roles and LDAP working
bradly Nov 16, 2010
e3212b5
Fixed some issues with access to projects for non admins.
bradly Nov 17, 2010
256d81b
Removing old call and updating to new user role for recipes.
bradly Nov 17, 2010
263ad29
Fixed bug with on the fly registration. Attrs were not being set.
bradly Nov 18, 2010
e8d6160
Adding archived flag to projects
bradly Dec 1, 2010
07053a7
Allows projects to be archived and made pages much faster with less
bradly Dec 6, 2010
9aa5913
Fixing bug when creating a project.
bradly Dec 14, 2010
1093a52
Fixed big with sorting objects for the sidebar.
bradly Dec 14, 2010
9386f8e
Only showing projects a user can view.
bradly Dec 20, 2010
b91b4c3
Making any user with a project assigned to them able to edit the proj…
bradly Jan 4, 2011
ae6cc15
Merge remote branch 'peritor/master'
bradly Apr 21, 2011
76998dd
fix namespace issue
alexspeller Jun 10, 2011
27a3589
Fix bug with private method being called
alexspeller Jun 9, 2011
1f2b6b1
Deployer shouldn't do a local query with mercurial eiter
alexspeller Jun 10, 2011
59d91b3
Xlaxed bundler requirement
janschumann Apr 5, 2012
bf7d9a2
Merge remote branch 'alexspeller/peritor_changes'
janschumann Apr 5, 2012
cbbb06f
added rdoc gem
janschumann Feb 12, 2013
5120888
using rdoc/rask instead of rake/rdoctask
janschumann Feb 12, 2013
e37ad6f
added idea files to ignore
Aug 12, 2013
fda1395
removed vendor gems
janschumann Jun 21, 2013
1b40998
fixed bundler dependency
Aug 12, 2013
cbdb397
fixed rdoc dependency
Aug 12, 2013
e14ce51
fixed 'undefined method symlink for class Capistrano::Configuration::…
Aug 12, 2013
db45dc1
added base passenger configuration
Aug 12, 2013
bd241ed
upgraded to the latest versions of all used gems including rails 2.3.18
Aug 15, 2013
903bf59
rails 3 app created and upgrade applied
Aug 15, 2013
5e1db22
added Gemfile.lock after bundle install
Aug 15, 2013
ed6ef6e
added exceoption notification gem as described in documentation but c…
Aug 15, 2013
32bdda2
added autoload path for lib folder and added browser filter plugin
Aug 15, 2013
d2ca14b
fixed time formatting usage
Aug 15, 2013
e4c77c8
fixed breadcrumb
Aug 15, 2013
29f8dfa
reverted js files and saved rails 3 ones as backup
Aug 15, 2013
99d8c45
added prototype_legacy_helper to support observe_field
Aug 15, 2013
79f2726
get rid of @controller deprecation warning
Aug 15, 2013
2604285
get rid of validation deprecation warnings
Aug 15, 2013
5768a52
get rid of lock helpers that use concat (e.g., form_for) should use <…
Aug 15, 2013
f552377
get rid of validation deprecation errors
Aug 15, 2013
0250155
fixed require test_help to rails/test_help
Aug 15, 2013
84c0e2b
get rid of Errors#on have been deprecated, use Errors#[] instead warning
Aug 15, 2013
9be0360
renamed method as named_scope was renamed to scope
Aug 15, 2013
10e3bfd
moved preinitializer code to application.rb
Aug 15, 2013
c78ca27
updated Gemfile.lock
Aug 15, 2013
b03b004
correct usage of save without validation
Aug 15, 2013
2c09c3d
fixed html errors
Aug 15, 2013
c40bc23
fixed undefined method errors
Aug 15, 2013
dce8500
removed method using private write_attribute
Aug 15, 2013
41ccfa9
added versions_fu plugin and session dispacher options
Aug 15, 2013
c14970d
upgraded mocha version
Aug 15, 2013
4de5de9
removed old rails2 backups
Aug 15, 2013
756c244
updated Gemfile.lock
Aug 15, 2013
d86ca4e
removed orphan rails2 scripts
Aug 15, 2013
e0f4159
get rid of the h() function as escaping is done automatically in rails 3
Aug 16, 2013
4811e60
removed wrong error access. added logging to see what to do here.
Aug 16, 2013
ed09d9f
fixed string concatination
Aug 16, 2013
32c311f
output raw values in capfile template
Aug 16, 2013
73f7a0c
using prototype 1.7
Aug 16, 2013
444297b
upgraded routing configuration
Aug 16, 2013
3891f63
fixed escaping
Aug 16, 2013
2978d6a
get rid of rails constants deprecation errors
Aug 16, 2013
fc85825
using log level error in production
Aug 16, 2013
f9c1240
do not use rails constants
Aug 16, 2013
c682a62
using rails 3 js files and fixed recipes preview ajax call
Aug 16, 2013
24fd81e
added styles
Oct 17, 2013
b792158
Merge remote-tracking branch 'bradly/master' into rails3
Dec 11, 2013
1aca696
added ldap as dependency and added auth sources link to user view
Dec 11, 2013
b7e64ee
Merge remote-tracking branch 'origin/rails3'
Dec 11, 2013
e5ef28b
Update README
jschwellach Dec 11, 2013
7c29174
Update CHANGELOG.txt
jschwellach Dec 11, 2013
2343380
moved the default user to the end to fix creation error
jschwellach Dec 20, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 14 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@

# ide files
.idea
*.iml

# confid files
config/*.yml
config/webistrano_config.rb
tmp/*
log/*

# mac files
*~
.DS_Store
*.tmproj
Gemfile.lock

# rails3 default
.bundle
db/*.sqlite3
log/*.log
tmp/
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.5 - JS 1.0
* added rails 3 support (merged from janschumann)

* added ldap and extra rights (merged from bradly)

* included auth sources ui in user edit view


edge

Expand Down
59 changes: 47 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
source "http://rubygems.org"

gem 'bundler', "~>1.0.10"
gem "rails", "2.3.11"
gem "mysql"
gem "erubis"
gem "rake"
gem "syntax", "1.0.0"
gem "capistrano", "2.6.0"
gem "open4", "0.9.3"
gem "exception_notification", "2.3.3.0"
source 'http://rubygems.org'

gem 'rails', '3.0.20'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2', '~> 0.2.17'

gem 'net-ssh', :require => 'net/ssh'
gem 'net-scp', :require => 'net/scp'
gem 'net-sftp', :require => 'net/sftp'
gem 'net-ldap', :require => 'net/ldap'
gem 'net-ssh-gateway', :require => 'net/ssh/gateway'
gem 'capistrano'
gem 'highline'
gem 'open4'
gem 'syntax'

# could not make it work
#gem 'exception_notification', :require => 'exception_notifier'

gem 'prototype_legacy_helper', '0.0.0', :git => 'git://github.com/rails/prototype_legacy_helper.git'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end

group :test do
gem "mocha", "0.9.8"
gem "mocha", "0.13.2", :require => false
end
115 changes: 115 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
GIT
remote: git://github.com/rails/prototype_legacy_helper.git
revision: a2cd95c3e3c1a4f7a9566efdab5ce59c886cb05f
specs:
prototype_legacy_helper (0.0.0)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.20)
actionpack (= 3.0.20)
mail (~> 2.2.19)
actionpack (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.5)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.20)
activesupport (= 3.0.20)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
activesupport (3.0.20)
arel (2.0.10)
builder (2.1.2)
capistrano (2.6.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
erubis (2.6.6)
abstract (>= 1.0.0)
highline (1.6.19)
i18n (0.5.0)
json (1.8.0)
mail (2.2.20)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
mime-types (1.24)
mocha (0.13.2)
metaclass (~> 0.0.1)
mysql2 (0.2.20)
net-ldap (0.3.1)
net-scp (1.1.1)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.6.7)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
open4 (0.9.3)
polyglot (0.3.3)
rack (1.2.8)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.20)
actionmailer (= 3.0.20)
actionpack (= 3.0.20)
activerecord (= 3.0.20)
activeresource (= 3.0.20)
activesupport (= 3.0.20)
bundler (~> 1.0)
railties (= 3.0.20)
railties (3.0.20)
actionpack (= 3.0.20)
activesupport (= 3.0.20)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
syntax (1.0.0)
thor (0.14.6)
treetop (1.4.14)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)

PLATFORMS
ruby

DEPENDENCIES
capistrano
highline
mocha (= 0.13.2)
mysql2 (~> 0.2.17)
net-ldap
net-scp
net-sftp
net-ssh
net-ssh-gateway
open4
prototype_legacy_helper (= 0.0.0)!
rails (= 3.0.20)
syntax
25 changes: 25 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
== Welcome to Webistrano on Rails 3 including LDAP authentication



== Getting Started

To install this version just clone the repo into your local directory and run "bundle install".
This should download all needed dependencies. If you encounter problems check if ruby 1.9.x and bundler
(gem install bundle) are installed.

== Configure Webistrano

To configure webistrano please remove (or copy the files) the sample files in the config dir and edit it accordingly.

== First run

To initialize the database you have to run a rake command. You can execute it via "bundle exec rake db:migrate" this will
execute the migration of the development environment. If you want to migrate or initialize another environment just run
the command like that: "RAILS_ENV=production bundle exec rake db:migrate".

To do a dry run you can just execute "script/rails s" and a server should be launched on http://localhost:3000.

== Passenger configuration
TBD

7 changes: 2 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'
Www::Application.load_tasks
68 changes: 52 additions & 16 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,57 +1,93 @@
class ApplicationController < ActionController::Base
include BrowserFilters
include ExceptionNotification::Notifiable

# could not male it work
# include ExceptionNotification::Notifiable
include AuthenticatedSystem

before_filter CASClient::Frameworks::Rails::Filter if WebistranoConfig[:authentication_method] == :cas
before_filter :login_from_cookie, :login_required, :ensure_not_disabled
before_filter :login_from_cookie, :login_required, :ensure_not_disabled, :setup_sidebar_vars
around_filter :set_timezone

layout 'application'

helper :all # include all helpers, all the time
helper_method :current_stage, :current_project

# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery

protected

def setup_sidebar_vars
if logged_in?
@sidebar_projects = Project.active.select { |p| current_user.can_view?(p) }
@sidebar_hosts = @sidebar_projects.collect(&:stages).flatten.uniq.collect(&:hosts).flatten.uniq
@sidebar_recipes = @sidebar_projects.collect(&:stages).flatten.uniq.collect(&:recipes).flatten.uniq
@sidebar_users = User.find(:all, :order => "login ASC")
end
end

def set_timezone
# default timezone is UTC
Time.zone = logged_in? ? ( current_user.time_zone rescue 'UTC'): 'UTC'
yield
Time.zone = 'UTC'
end

def load_project
@project = Project.find(params[:project_id])
@project = Project.active.find(params[:project_id] || params[:id])
end

def load_stage
load_project
@stage = @project.stages.find(params[:stage_id])
end

def current_stage
@stage
end

def current_project
@project
end

def ensure_admin
if logged_in? && current_user.admin?
return true
else
flash[:notice] = "Action not allowed"
redirect_to home_path
return false
handle_no_access
end
end

def handle_no_access(messsage = "Action not allowed")
flash[:notice] = messsage
redirect_to home_path
return false
end

def ensure_can_access_project(project=nil)
project ||= @project
@can_access_project = current_user.can_view?(project) or handle_no_access
end

def ensure_can_manage_projects
@can_manage_projects = current_user.can_manage_projects? or handle_no_access
end

def ensure_can_edit_project
@can_edit_project = current_user.can_edit?(@project) or handle_no_access
end

def ensure_can_manage_hosts
current_user.can_manage_hosts? or handle_no_access
end

def ensure_can_manage_recipes
current_user.can_manage_recipes? or handle_no_access
end

def ensure_not_disabled
if logged_in? && current_user.disabled?
logout
Expand All @@ -60,7 +96,7 @@ def ensure_not_disabled
return true
end
end

def logout
self.current_user.forget_me if logged_in?
cookies.delete :auth_token
Expand All @@ -72,5 +108,5 @@ def logout
redirect_to "#{CASClient::Frameworks::Rails::Filter.config[:logout_url]}?serviceUrl=#{home_url}"
end
end

end
Loading