2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
# Include this module to have an object respond to user messages without being
|
|
|
|
# a user.
|
|
|
|
#
|
|
|
|
# Use Case 1:
|
|
|
|
# Pass something else than the user to check policies. This defines several
|
|
|
|
# methods which the policy checker would call and check.
|
|
|
|
#
|
|
|
|
# Use Case 2:
|
|
|
|
# Access the API with non-user object such as deploy tokens. This defines
|
|
|
|
# several methods which the API auth flow would call.
|
2018-11-18 11:00:15 +05:30
|
|
|
module PolicyActor
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
def blocked?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def admin?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def external?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def internal?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def access_locked?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def required_terms_not_accepted?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_create_group
|
|
|
|
false
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
def alert_bot?
|
|
|
|
false
|
|
|
|
end
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
def support_bot?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
def security_bot?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
def deactivated?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def confirmation_required_on_sign_in?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def can?(action, subject = :global)
|
|
|
|
Ability.allowed?(self, action, subject)
|
|
|
|
end
|
|
|
|
|
|
|
|
def preferred_language
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def requires_ldap_check?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def try_obtain_ldap_lease
|
|
|
|
nil
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
def can_read_all_resources?
|
|
|
|
false
|
|
|
|
end
|
2021-06-02 17:11:27 +05:30
|
|
|
|
2021-07-02 01:05:55 +05:30
|
|
|
def password_expired_if_applicable?
|
2021-06-02 17:11:27 +05:30
|
|
|
false
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
PolicyActor.prepend_mod_with('PolicyActor')
|