Created
December 21, 2008 21:40
-
-
Save dmilith/38773 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User | |
| include DataMapper::Resource | |
| property :id, Serial, :index => true | |
| property :login, String, :limit => 75, :nullable => false | |
| property :pass, String, :limit => 100 | |
| property :first_name, String, :limit => 75 | |
| property :last_name, String, :limit => 75 | |
| property :email, String, :limit => 75, :nullable => false | |
| property :telephone, String, :limit => 75 | |
| property :address, String, :limit => 255 | |
| property :admin, Boolean, :null => false, :default => false, :index => true | |
| property :active, Boolean, :null => false, :default => false, :index => true | |
| property :activation_token, String, :limit => 50 | |
| property :salt, String | |
| property :rack_access, Boolean, :default => false, :nullable => false, :index => true | |
| property :vhost_access, Boolean, :default => false, :nullable => false, :index => true | |
| property :mail_access, Boolean, :default => false, :nullable => false, :index => true | |
| property :database_access, Boolean, :default => false, :nullable => false, :index => true # nullable => false infers 'validates_presence_of :database_access | |
| property :cookie_hash, String | |
| has n, :usage_permissions | |
| has n, :domains, :through => :usage_permissions | |
| has n, :subdomains | |
| has n, :ports | |
| has n, :memory_usage_records | |
| validates_format :login, :format => /^[\w-]+$/, :message => "Możesz używać tylko alfanumerycznych znaków liczb - i _ w loginie!" | |
| validates_format :first_name, :last_name, :email, :telephone, :address, | |
| :format => /^([ążźśćńłóęĄŻŹŚĆŃŁÓĘ1-zA-Z0-1@.\s]{1,255})$/, :message => "Podając dane proszę nie używać znaków: ‘\*&$<> !" | |
| validates_format :email, :format => /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*/, | |
| :message => "Podany adres E-Mail jest nieprawidłowy" | |
| validates_is_unique :login | |
| # validates_present :password, :on => :create | |
| validates_is_number :telephone | |
| validates_format :password, :format => /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[\x20-\x7E]{8,20}$/, | |
| :message => "musi zawierać co najmniej jedną: cyfrę, małą literę i dużą literę oraz składać się z 8 do 20 znaków", | |
| :on => :create | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment