From cad7e003fbb3f4f63942da8ce4346d9f1c25f1f6 Mon Sep 17 00:00:00 2001 From: William Hearn Date: Wed, 25 May 2016 12:48:09 -0400 Subject: [PATCH] Multi User context support. --- deploy_plus.module | 11 +++++++++++ plugins/content_types/deploy/deploy.inc | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/deploy_plus.module b/deploy_plus.module index 7e3bd07..5dab1bd 100644 --- a/deploy_plus.module +++ b/deploy_plus.module @@ -143,12 +143,23 @@ function deploy_plus_plan_action($entity, $context) { * @see deploy_plus_action_info() */ function deploy_plus_plan_action_form($context, $form_state) { + global $user; $form = array(); $plans = deploy_plan_load_all(); $options = array(); foreach ($plans as $name => $plan) { + + if (variable_get('deploy_plus_user_context', FALSE)) { + if (strpos($plan->name, 'destination_site_plan_') === 0) { + if ($plan->name != 'destination_site_plan_' . $user->name) { + unset($plans[$plan->name]); + continue; + } + } + } + $options[t('Add to managed deployment plan')]["add_to:$name"] = $plan->title; $options[t('Remove from managed deployment plan')]["delete_from:$name"] = $plan->title; } diff --git a/plugins/content_types/deploy/deploy.inc b/plugins/content_types/deploy/deploy.inc index 1640d98..79cddb8 100644 --- a/plugins/content_types/deploy/deploy.inc +++ b/plugins/content_types/deploy/deploy.inc @@ -39,6 +39,7 @@ function deploy_plus_deploy_content_type_admin_info($subtype = NULL, $conf = NUL * Run-time rendering of the body of the block. */ function deploy_plus_deploy_content_type_render($subtype, $conf, $panel_args, &$context) { + global $user; $block = new stdClass(); $block->title = t('Deploy Plus'); @@ -47,6 +48,17 @@ function deploy_plus_deploy_content_type_render($subtype, $conf, $panel_args, &$ // Iterate over all plans. foreach ($plans as $plan) { + + // Skip other custom deploy plans. + if (variable_get('deploy_plus_user_context', FALSE)) { + if (strpos($plan->name, 'destination_site_plan_') === 0) { + if ($plan->name != 'destination_site_plan_' . $user->name) { + unset($plans[$plan->name]); + continue; + } + } + } + $info = array(); // Get the entity keys from the aggregator. -- 2.5.4 (Apple Git-61)