Starting companies and admin

This commit is contained in:
2022-02-08 17:33:34 +00:00
parent 0ff91bbf3a
commit 557b43c911
30 changed files with 934 additions and 5 deletions

27
app/models/user.rb Normal file
View File

@@ -0,0 +1,27 @@
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
has_and_belongs_to_many :companies
devise :database_authenticatable,
:recoverable, :rememberable, :validatable
def admin?
true if self.role == 1000
end
def user?
true if self.role == 100
end
def roletxt
role = "undefined"
if self.role == 1000
role = "Admin"
end
if self.role == 100
role = "User"
end
role
end
end