Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stripe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
Stripe
Commits
0d4cf3c1
Commit
0d4cf3c1
authored
2 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Make StripePaymentintent.ProcessPublic conditional on 'make online contributions' permission
parent
555d3c5b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!209
6.8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Civi/Api4/StripePaymentintent.php
+4
-1
4 additions, 1 deletion
Civi/Api4/StripePaymentintent.php
docs/faqs.md
+7
-0
7 additions, 0 deletions
docs/faqs.md
stripe.php
+15
-0
15 additions, 0 deletions
stripe.php
with
26 additions
and
1 deletion
Civi/Api4/StripePaymentintent.php
+
4
−
1
View file @
0d4cf3c1
...
...
@@ -13,7 +13,10 @@ class StripePaymentintent extends Generic\DAOEntity {
public
static
function
permissions
()
{
$permissions
=
parent
::
permissions
();
$permissions
[
'processMOTO'
]
=
[
'allow stripe moto payments'
];
$permissions
[
'processPublic'
]
=
[
\CRM_Core_Permission
::
ALWAYS_ALLOW_PERMISSION
];
// The "minimum" permission for an API4 call is "access CiviCRM"|"access AJAX API".
// We can't remove the requirement for one of those permissions here.
// So we specify only 'make online contributions' using alterAPIRoutePermissions hook.
// $permissions['processPublic'] = ['make online contributions'];
return
$permissions
;
}
...
...
This diff is collapsed.
Click to expand it.
docs/faqs.md
+
7
−
0
View file @
0d4cf3c1
# FAQ
## Permissions
To accept payments using Stripe you must have "make online contributions" permission enabled.
No other permissions are required.
## Terminology
#### CiviCRM <=> Stripe
...
...
This diff is collapsed.
Click to expand it.
stripe.php
+
15
−
0
View file @
0d4cf3c1
...
...
@@ -255,3 +255,18 @@ function stripe_civicrm_permission(&$permissions) {
$permissions
[
'allow stripe moto payments'
]
=
E
::
ts
(
'CiviCRM Stripe: Process MOTO transactions'
);
}
}
/**
* Implements hook_civicrm_alterApiRoutePermissions().
*
* @see CRM_Utils_Hook::alterApiRoutePermissions
*/
function
stripe_civicrm_alterApiRoutePermissions
(
&
$permissions
,
$entity
,
$action
)
{
if
(
$entity
==
'StripePaymentintent'
)
{
// These actions should be accessible to anonymous users; permissions are checked internally
$allowedActions
=
[
'ProcessPublic'
];
if
(
in_array
(
$action
,
$allowedActions
,
TRUE
))
{
$permissions
=
'make online contributions'
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment