Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies/concerns/policy_actor.rb')
-rw-r--r--app/policies/concerns/policy_actor.rb37
1 files changed, 34 insertions, 3 deletions
diff --git a/app/policies/concerns/policy_actor.rb b/app/policies/concerns/policy_actor.rb
index 406677d7b56..f910e04d015 100644
--- a/app/policies/concerns/policy_actor.rb
+++ b/app/policies/concerns/policy_actor.rb
@@ -1,8 +1,15 @@
# frozen_string_literal: true
-# Include this module if we want to pass something else than the user to
-# check policies. This defines several methods which the policy checker
-# would call and check.
+# 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.
module PolicyActor
extend ActiveSupport::Concern
@@ -37,6 +44,30 @@ module PolicyActor
def alert_bot?
false
end
+
+ 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
end
PolicyActor.prepend_if_ee('EE::PolicyActor')