diff options
author | David Gay <david@davidgay.org> | 2021-05-19 21:34:16 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-19 21:34:16 -0400 |
commit | da678b22b5db05554b44234b341fabc9d83ff700 (patch) | |
tree | 6eaa62d82eba324205ce6c10d05021ad78a8326b /app | |
parent | 5afdcd12f04102b5cf5d5a310981bc576a992119 (diff) |
Add permission level to Users
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 59d9ac3..bc09808 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,4 +5,18 @@ class User < ApplicationRecord :confirmable, :lockable has_many :characters belongs_to :active_character, class_name: "Character", optional: true + attribute :permission_level, :integer, default: 1 + enum permission_level: { + banned: 0, + player: 1, + helper: 2, + builder: 3, + admin: 4, + developer: 5, + owner: 6 + } + + def has_permission_or_higher?(permission_level) + User.permission_levels[self.permission_level] >= User.permission_levels[permission_level] + end end |