Skip to content

Commit

Permalink
Merge pull request #77 from audiovisuel-uqam/UserRoleCapabilities
Browse files Browse the repository at this point in the history
Create capability cloudfront_clear_cache
  • Loading branch information
wokamoto authored Nov 2, 2021
2 parents df5a7e1 + 159cec8 commit 2af5ca2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion classes/Views/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ function () {
*/
$this->hook_service->add_filter( 'amimoto_show_c3_setting_form', '__return_false' );
$this->hook_service->add_filter( 'amimoto_show_invalidation_form', '__return_false' );

$this->hook_service->add_action( 'admin_init', array( $this, 'define_caps' ) );
}

/**
Expand All @@ -67,7 +69,7 @@ public function create_options_page() {
add_options_page(
__( 'CloudFront Settings', Constants::text_domain() ),
__( 'CloudFront Settings', Constants::text_domain() ),
'administrator',
'cloudfront_clear_cache',
Constants::MENU_ID,
function () {
require_once( C3_PLUGIN_PATH . '/templates/Settings.php' );
Expand All @@ -85,6 +87,17 @@ function () {
);
}

/**
* Define C3 plugin capabilities
*
* @access public
* @param none
* @since 4.0.0
*/
public function define_caps() {
$role = get_role( 'administrator' );
$role->add_cap( 'cloudfront_clear_cache' );
}
/**
* Filter the saving option's request
*
Expand Down

0 comments on commit 2af5ca2

Please sign in to comment.