Permalink
Browse files

- Move everything to trunk

git-svn-id: svn+ssh://rubyforge.org/var/svn/railscollab/trunk@108 1e8d30c7-b1cd-4b0d-952e-12ddc4cacc65
  • Loading branch information...
1 parent bdc8b6b commit b8b1a4db6487f3e873c69f7e6a5d73d424a8c910 jamesu committed Nov 6, 2007
Showing 437 changed files with 24,968 additions and 0 deletions.
View
504 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
View
139 README
@@ -0,0 +1,139 @@
+RailsCollab
+-----------
+
+RailsCollab is a port of the project management tool
+ActiveCollab (which is written in PHP) to the Ruby on Rails framework,
+obviously written in Ruby.
+
+For licensing details, refer to the LICENSE file in the root directory.
+
+First and foremost
+******************
+
+Whilst RailsCollab implements many security features, it is advised that you
+should be cautious when using it within an untrusted environment as it is still
+considered to be under development and thus may be susceptible to as-of-yet unknown
+security exploits.
+
+Requirements
+************
+
+Along with a working installation of the Ruby on Rails Framework, you will need the
+following to deploy & run RailsCollab:
+ - iCalendar (http://icalendar.rubyforge.org/)
+ - Ruby/GD2 (http://gd2.rubyforge.org/)
+ - RedCloth (http://whytheluckystiff.net/ruby/redcloth/)
+ - ruby-openid (gem install ruby-openid)
+
+Upgrading from ActiveCollab
+***************************
+
+Currently the database model of RailsCollab is identical to
+that of ActiveCollab, with the exception of changes in the naming
+conventions of certain fields.
+
+More or less all the features of ActiveCollab are implemented, with the exception
+of the following:
+ - Message subscription
+ - E-mail dispatching
+ - File thumbnails
+ - Administration tools
+ - Runtime configuration editor
+
+In order to facilitate the migration from ActiveCollab to RailsCollab,
+a rake task called db:railscollab:migrate_from_activecollab has been provided,
+which converts the tables in the current database (as specified in config/database.yml)
+into a schema compatible with RailsCollab.
+
+The rake task supports the following versions of ActiveCollab, which can
+be explicitly specified by setting the ACTIVECOLLAB_VERSION environment
+variable:
+ - 0.7.1 : (default)
+ - 0.7.1 : with the unofficial time tracking enhancements (auto-detected)
+Note that any other version should be considered unsupported.
+It should also be noted that ONLY MYSQL DATABASES ARE SUPPORTED by this task.
+If for example you wanted to port over an ActiveCollab install but base
+everything in SQLite instead, you would probably be better using one of the
+as-of-yet non-existent web api's to copy everything over.
+
+So to sum it up, you would do something like the following to upgrade:
+1) Copy your ActiveCollab installation's MySQL database to a SEPERATE DATABASE
+called railscollab
+2) Create a config/database.yml file based on config/database.yml.template,
+using either the development or production environments as your basis.
+3) Run 'rake db:railscollab:migrate_from_activecollab' from the root directory
+
+And to make sure it works:
+4) Run 'script/server -e <insert development or production here>'
+5) Go to http://localhost:3000 and login using your usual credentials
+
+File Storage
+************
+
+RailsCollab allows the user to upload files, provided they have sufficient
+permissions. Files are stored according to the "file_upload_storage" option.
+Note that the "local_database" storage option is currently the only implemented
+storage system in RailsCollab.
+
+When using the "local_database" storage option, you might notice that files you
+upload may be limited to 64kb. This is likely due to the rails migration creating
+a storage field of insufficient capacity. To solve this problem you should modify the
+field type of the "content" field in the "file_repo" table located in your database
+accordingly.
+
+Deployment
+**********
+
+In order to facilitate deployment, a rake task called db:railscollab:install
+has been provided, which will create a minimal installation.
+The rake task accepts the following environment variables:
+ RAILSCOLLAB_INITIAL_USER
+ The username of the administrative user
+ (default='admin')
+ RAILSCOLLAB_INITIAL_DISPLAYNAME
+ The display name of the administrative user
+ (default='Administrator')
+ RAILSCOLLAB_INITIAL_PASSWORD
+ The password of the administrative user
+ (default='password')
+ RAILSCOLLAB_INITIAL_EMAIL
+ The email address of the administrative user
+ (default='better.set.this@localhost')
+ RAILSCOLLAB_INITIAL_COMPANY
+ The initial name of the owner company
+ (default='Company')
+
+Note that as with any other database rake task, you will need to have the
+config/database.yml file present which contains the database connection
+settings. An example file is present at config/database.yml.template,
+which contains example settings for a rather insecure mysql database setup.
+
+In addition, RailsCollab reads various configuration options from
+config/config.yml, which must be present in order to run the server or
+perform any of the rake tasks. An example file is present at
+config/config.yml.template, which contains example settings.
+
+So from scratch, you'd likely do something like to following to install:
+1) Create a 'railscollab' database
+2) Create a config/database.yml file based on config/database.yml.template,
+using either the development or production environments as your basis.
+3) Create a 'config/config.yml' file based on config/config.yml.template,
+filling in options where applicable.
+4) Run 'RAILSCOLLAB_INITIAL_USER="billg" \
+RAILSCOLLAB_INITIAL_DISPLAYNAME="Bill Gates" \
+RAILSCOLLAB_INITIAL_PASSWORD="microsoft" \
+RAILSCOLLAB_INITIAL_EMAIL="billg@microsoft.com" \
+RAILSCOLLAB_INITIAL_COMPANY="Microsoft" \
+rake db:railscollab:install'
+
+And to make sure it works:
+5) Run 'script/server -e <insert development or production here>'
+6) Go to http://localhost:3000 and login using your supplied credentials
+
+For proper deployment (e.g. using FastCGI or load balancing proxies), refer to
+the Ruby on Rails documentation.
+
+Finally
+*******
+
+Good luck.
View
@@ -0,0 +1,10 @@
+# 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 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
@@ -0,0 +1,115 @@
+=begin
+RailsCollab
+-----------
+Copyright (C) 2007 James S Urquhart (jamesu at gmail.com)This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+=end
+
+class AccessController < ApplicationController
+
+ layout 'dialog'
+
+ if AppConfig.allow_openid
+ open_id_consumer
+ end
+
+ def login
+ case @request.method
+ when :post
+ login_params = params[:login]
+ remember = login_params[:remember]
+
+ # Normal boring username + password
+ @logged_user = User.authenticate(login_params['user'], login_params['password'])
+
+ if !@logged_user.nil?
+ flash[:flash_success] = "Login successful"
+ redirect_back_or_default :controller => "dashboard"
+
+ session['user_id'] = @logged_user.id
+ else
+ flash[:flash_error] = "Login unsuccessful"
+ end
+ end
+ end
+
+ def begin
+ # If the URL was unusable (either because of network conditions,
+ # a server error, or that the response returned was not an OpenID
+ # identity page), the library will return HTTP_FAILURE or PARSE_ERROR.
+ # Let the user know that the URL is unusable.
+ case open_id_response.status
+ when OpenID::SUCCESS
+ # The URL was a valid identity URL. Now we just need to send a redirect
+ # to the server using the redirect_url the library created for us.
+
+ # redirect to the server
+ redirect_to open_id_response.redirect_url((request.protocol + request.host_with_port + '/'), url_for(:action => 'complete'))
+ else
+ flash[:flash_error] = "Unable to find openid server for <q>#{params[:openid_url]}</q>"
+ redirect_to :action => 'login'
+ end
+ end
+
+ def complete
+ case open_id_response.status
+ when OpenID::FAILURE
+ # In the case of failure, if info is non-nil, it is the
+ # URL that we were verifying. We include it in the error
+ # message to help the user figure out what happened.
+ if open_id_response.identity_url
+ flash[:flash_error] = "Verification of #{open_id_response.identity_url} failed. "
+ else
+ flash[:flash_error] = "Verification failed. "
+ end
+ flash[:message] += open_id_response.msg.to_s
+
+ when OpenID::SUCCESS
+ # Success means that the transaction completed without
+ # error. If info is nil, it means that the user cancelled
+ # the verification.
+
+ log_user = User.openid_login(open_id_response.identity_url)
+ if log_user.nil?
+ flash[:flash_error] = "Failed login with identity #{open_id_response.identity_url}."
+ else
+ flash[:flash_success] = "You have successfully logged in with #{open_id_response.identity_url} as your identity."
+ redirect_back_or_default :controller => "dashboard"
+ session['user_id'] = log_user.id
+ return
+ end
+
+ when OpenID::CANCEL
+ flash[:flash_error] = "Verification cancelled."
+
+ else
+ flash[:flash_error] = "Unknown response status: #{open_id_response.status}"
+ end
+ redirect_to :action => 'login'
+ end
+
+ def logout
+ session['user_id'] = nil
+ redirect_to :controller => 'access', :action => 'login'
+ end
+
+ def forgot_password
+ case @request.method
+ when :post
+ @your_email = params[:your_email]
+
+ if not @your_email =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
+ flash[:flash_error] = "Invalid email address"
+ return
+ end
+
+ user = User.by_email(@your_email)
+ if user.nil?
+ flash[:flash_error] = "Email address not in use"
+ return
+ end
+
+ # TODO
+ end
+ end
+
+end
Oops, something went wrong.

0 comments on commit b8b1a4d

Please sign in to comment.