diff --git a/app/models/principal.rb b/app/models/principal.rb index 56da6d9c7..f29e47358 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -145,6 +145,10 @@ class Principal < ApplicationRecord project.is_a?(Project) && project_ids.include?(project.id) end + def active? = (status == STATUS_ACTIVE) + def registered? = (status == STATUS_REGISTERED) + def locked? = (status == STATUS_LOCKED) + # Returns an array of the project ids that the principal is a member of def project_ids @project_ids ||= super.freeze diff --git a/app/models/user.rb b/app/models/user.rb index ee1303d41..049bda515 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -273,18 +273,6 @@ class User < Principal end end - def active? - self.status == STATUS_ACTIVE - end - - def registered? - self.status == STATUS_REGISTERED - end - - def locked? - self.status == STATUS_LOCKED - end - def activate self.status = STATUS_ACTIVE end diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb index 0e5288f1b..59923927c 100644 --- a/test/unit/group_test.rb +++ b/test/unit/group_test.rb @@ -38,6 +38,7 @@ class GroupTest < ActiveSupport::TestCase assert g.save g.reload assert_equal 'New group', g.name + assert_equal true, g.active? end def test_name_should_accept_255_characters