aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2013-10-17 12:28:26 +0200
committerMichel Etienne2013-10-17 12:28:26 +0200
commitb18982f41f9910c5ffb70d4d073a7b5940ee5d38 (patch)
tree9f4fca0b7bf6fc4bc601731d3dbd2d82102e5ac6
parent40e33f9d80a9444ba144a830a46b11814c089aea (diff)
downloadchouette-core-b18982f41f9910c5ffb70d4d073a7b5940ee5d38.tar.bz2
referential slug should not be database user
-rw-r--r--app/models/referential.rb3
-rw-r--r--config/locales/referentials.yml4
2 files changed, 6 insertions, 1 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb
index aef32cb3d..4c68e9f29 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -33,6 +33,9 @@ class Referential < ActiveRecord::Base
if slug == 'public'
errors.add(:slug,I18n.t("referentials.errors.public_excluded"))
end
+ if slug == connection.config[:username]
+ errors.add(:slug,I18n.t("referentials.errors.user_excluded", :user => slug))
+ end
end
end
diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml
index 7049949b9..d39ec4bcc 100644
--- a/config/locales/referentials.yml
+++ b/config/locales/referentials.yml
@@ -26,7 +26,8 @@ en:
edit: "Edit this data space"
errors:
pg_excluded: "can't begins with pg_"
- public_excluded: "public is reserved value"
+ public_excluded: "public is a reserved value"
+ user_excluded: "%{user} is a reserved value"
activerecord:
models:
referential:
@@ -98,6 +99,7 @@ fr:
errors:
pg_excluded: "ne peut pas commencer par pg_ (valeurs réservées)"
public_excluded: "public est une valeur réservée"
+ user_excluded: "%{user} est une valeur réservée"
activerecord:
models:
referential: