summaryrefslogtreecommitdiffstats
path: root/redmine/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-07-29 19:54:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-07-29 19:54:22 +0000
commitb862c447f16e7528a64fbf1bbeba1b4b3c8f573f (patch)
tree55d91cae14f22906041821a11818dc0dfa7cdadb /redmine/app/models
parent5b47d7bfcc241c6117d3ecf71c68bac90eac05fa (diff)
downloadredmine-b862c447f16e7528a64fbf1bbeba1b4b3c8f573f.tar.gz
redmine-b862c447f16e7528a64fbf1bbeba1b4b3c8f573f.zip
Localization plugin removed (replaced with GLoc)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@14 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'redmine/app/models')
-rw-r--r--redmine/app/models/auth_source_ldap.rb2
-rw-r--r--redmine/app/models/enumeration.rb12
-rw-r--r--redmine/app/models/issue_status.rb4
-rw-r--r--redmine/app/models/mailer.rb3
-rw-r--r--redmine/app/models/member.rb18
-rw-r--r--redmine/app/models/news.rb18
-rw-r--r--redmine/app/models/permission.rb32
-rw-r--r--redmine/app/models/role.rb10
-rw-r--r--redmine/app/models/tracker.rb4
-rw-r--r--redmine/app/models/user.rb3
10 files changed, 47 insertions, 59 deletions
diff --git a/redmine/app/models/auth_source_ldap.rb b/redmine/app/models/auth_source_ldap.rb
index 9579a1094..895cf1c63 100644
--- a/redmine/app/models/auth_source_ldap.rb
+++ b/redmine/app/models/auth_source_ldap.rb
@@ -30,7 +30,7 @@ class AuthSourceLdap < AuthSource
# get user's DN
ldap_con = initialize_ldap_con(self.account, self.account_password)
login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
- object_filter = Net::LDAP::Filter.eq( "objectClass", "organizationalPerson" )
+ object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
dn = String.new
ldap_con.search( :base => self.base_dn,
:filter => object_filter & login_filter,
diff --git a/redmine/app/models/enumeration.rb b/redmine/app/models/enumeration.rb
index 7f985d2f8..122da15c5 100644
--- a/redmine/app/models/enumeration.rb
+++ b/redmine/app/models/enumeration.rb
@@ -21,18 +21,14 @@ class Enumeration < ActiveRecord::Base
validates_presence_of :opt, :name
validates_uniqueness_of :name, :scope => [:opt]
- OPTIONS = [
- ["Issue priorities", "IPRI"],
- ["Document categories", "DCAT"]
- ].freeze
+ OPTIONS = {
+ "IPRI" => :enumeration_issue_priorities,
+ "DCAT" => :enumeration_doc_categories
+ }.freeze
def self.get_values(option)
find(:all, :conditions => ['opt=?', option])
end
-
- def name
- _ self.attributes['name']
- end
private
def check_integrity
diff --git a/redmine/app/models/issue_status.rb b/redmine/app/models/issue_status.rb
index ef9862092..426580987 100644
--- a/redmine/app/models/issue_status.rb
+++ b/redmine/app/models/issue_status.rb
@@ -38,10 +38,6 @@ class IssueStatus < ActiveRecord::Base
statuses
end
- def name
- _ self.attributes['name']
- end
-
private
def check_integrity
raise "Can't delete status" if Issue.find(:first, :conditions => ["status_id=?", self.id]) or IssueHistory.find(:first, :conditions => ["status_id=?", self.id])
diff --git a/redmine/app/models/mailer.rb b/redmine/app/models/mailer.rb
index bf4c85dbb..755764dc0 100644
--- a/redmine/app/models/mailer.rb
+++ b/redmine/app/models/mailer.rb
@@ -45,6 +45,5 @@ class Mailer < ActionMailer::Base
@from = 'redmine@somenet.foo'
@subject = "redMine account activation"
@body['token'] = token
- end
-
+ end
end
diff --git a/redmine/app/models/member.rb b/redmine/app/models/member.rb
index d37936561..1214b6443 100644
--- a/redmine/app/models/member.rb
+++ b/redmine/app/models/member.rb
@@ -16,14 +16,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Member < ActiveRecord::Base
- belongs_to :user
- belongs_to :role
- belongs_to :project
-
- validates_presence_of :role, :user, :project
+ belongs_to :user
+ belongs_to :role
+ belongs_to :project
+
+ validates_presence_of :role, :user, :project
validates_uniqueness_of :user_id, :scope => :project_id
-
- def name
- self.user.display_name
- end
+
+ def name
+ self.user.display_name
+ end
end
diff --git a/redmine/app/models/news.rb b/redmine/app/models/news.rb
index c4884ace5..faafa7eef 100644
--- a/redmine/app/models/news.rb
+++ b/redmine/app/models/news.rb
@@ -16,13 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class News < ActiveRecord::Base
- belongs_to :project
- belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
-
- validates_presence_of :title, :description
-
- # returns last created news
- def self.latest
- find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
- end
+ belongs_to :project
+ belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
+
+ validates_presence_of :title, :description
+
+ # returns last created news
+ def self.latest
+ find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
+ end
end
diff --git a/redmine/app/models/permission.rb b/redmine/app/models/permission.rb
index 164ca21b9..620974608 100644
--- a/redmine/app/models/permission.rb
+++ b/redmine/app/models/permission.rb
@@ -16,27 +16,27 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Permission < ActiveRecord::Base
- has_and_belongs_to_many :roles
-
- validates_presence_of :controller, :action, :description
-
+ has_and_belongs_to_many :roles
+
+ validates_presence_of :controller, :action, :description
+
GROUPS = {
- 100 => "Project",
- 200 => "Membres",
- 300 => "Versions",
- 400 => "Issue categories",
- 1000 => "Issues",
- 1100 => "News",
- 1200 => "Documents",
- 1300 => "Files",
- }.freeze
+ 100 => :label_project,
+ 200 => :label_member_plural,
+ 300 => :label_version_plural,
+ 400 => :label_issue_category_plural,
+ 1000 => :label_issue_plural,
+ 1100 => :label_news_plural,
+ 1200 => :label_document_plural,
+ 1300 => :label_attachment_plural,
+ }.freeze
@@cached_perms_for_public = nil
@@cached_perms_for_roles = nil
- def name
- self.controller + "/" + self.action
- end
+ def name
+ self.controller + "/" + self.action
+ end
def group_id
(self.sort / 100)*100
diff --git a/redmine/app/models/role.rb b/redmine/app/models/role.rb
index ce880b5cc..6908095e9 100644
--- a/redmine/app/models/role.rb
+++ b/redmine/app/models/role.rb
@@ -17,13 +17,13 @@
class Role < ActiveRecord::Base
before_destroy :check_integrity
- has_and_belongs_to_many :permissions
+ has_and_belongs_to_many :permissions
has_many :workflows, :dependent => true
has_many :members
-
- validates_presence_of :name
- validates_uniqueness_of :name
-
+
+ validates_presence_of :name
+ validates_uniqueness_of :name
+
private
def check_integrity
raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])
diff --git a/redmine/app/models/tracker.rb b/redmine/app/models/tracker.rb
index ca37eb939..a4376a351 100644
--- a/redmine/app/models/tracker.rb
+++ b/redmine/app/models/tracker.rb
@@ -24,10 +24,6 @@ class Tracker < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
- def name
- _ self.attributes['name']
- end
-
private
def check_integrity
raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id])
diff --git a/redmine/app/models/user.rb b/redmine/app/models/user.rb
index ea313483c..ba489ac14 100644
--- a/redmine/app/models/user.rb
+++ b/redmine/app/models/user.rb
@@ -57,7 +57,7 @@ class User < ActiveRecord::Base
# user has an external authentication method
return nil unless user.auth_source.authenticate(login, password)
else
- # local authentication
+ # authentication with local password
return nil unless User.hash_password(password) == user.hashed_password
end
else
@@ -69,6 +69,7 @@ class User < ActiveRecord::Base
onthefly.language = $RDM_DEFAULT_LANG
if onthefly.save
user = find(:first, :conditions => ["login=?", login])
+ logger.info("User '#{user.login}' created on the fly.") if logger
end
end
end