From 8b86d56ec0e9ccd1a42e295594c92a05ff8529ee Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 21 May 2009 14:49:28 +0000 Subject: [PATCH] added: Activate, Deactivate, Delete User workflow activities --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.7.6-7.7.7.pl | 11 +++ etc/WebGUI.conf.original | 5 +- lib/WebGUI/Workflow/Activity/ActivateUser.pm | 77 ++++++++++++++++++ .../Workflow/Activity/DeactivateUser.pm | 77 ++++++++++++++++++ lib/WebGUI/Workflow/Activity/DeleteUser.pm | 79 +++++++++++++++++++ lib/WebGUI/i18n/English/WebGUI.pm | 12 +++ 7 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 lib/WebGUI/Workflow/Activity/ActivateUser.pm create mode 100644 lib/WebGUI/Workflow/Activity/DeactivateUser.pm create mode 100644 lib/WebGUI/Workflow/Activity/DeleteUser.pm diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index e494ad60f..8c81335b9 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -20,6 +20,7 @@ - added: Storage now has a getHexId method for returning a cached hexadecimal version of the storageId. - fixed: FilePump should copy filesystem directories and their files when given a file URI that is a directory. - fixed #10133: Matrix compare for priv. group open to any user + - added: Activate, Deactivate, Delete User workflow activities 7.7.6 - Added mobile style template. If enabled in settings, will serve alternate style templates diff --git a/docs/upgrades/upgrade_7.7.6-7.7.7.pl b/docs/upgrades/upgrade_7.7.6-7.7.7.pl index 3f9631d2d..7f859ef40 100644 --- a/docs/upgrades/upgrade_7.7.6-7.7.7.pl +++ b/docs/upgrades/upgrade_7.7.6-7.7.7.pl @@ -43,6 +43,7 @@ installFilePumpHandler($session); installFilePumpTable($session); installFilePumpAdminGroup($session); addMatrixMaxGroup($session); +addUserControlWorkflows($session); finish($session); # this line required @@ -55,6 +56,16 @@ sub addMatrixMaxGroup { print "Done.\n" unless $quiet; } +#---------------------------------------------------------------------------- +sub addUserControlWorkflows { + my $session = shift; + print "\tAdding Activate, Deactivate, Delete User workflow activities..." unless $quiet; + $session->config->addToArray('workflowActivities/WebGUI::User', 'WebGUI::Workflow::Activity::ActivateUser'); + $session->config->addToArray('workflowActivities/WebGUI::User', 'WebGUI::Workflow::Activity::DeactivateUser'); + $session->config->addToArray('workflowActivities/WebGUI::User', 'WebGUI::Workflow::Activity::DeleteUser'); + print " Done.\n" unless $quiet; +} + #---------------------------------------------------------------------------- sub fixSMSUserProfileI18N { my $session = shift; diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index bd3273980..9722e793c 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -875,7 +875,10 @@ ], "WebGUI::User" : [ "WebGUI::Workflow::Activity::CreateCronJob", - "WebGUI::Workflow::Activity::NotifyAboutUser" + "WebGUI::Workflow::Activity::NotifyAboutUser", + "WebGUI::Workflow::Activity::ActivateUser", + "WebGUI::Workflow::Activity::DeactivateUser", + "WebGUI::Workflow::Activity::DeleteUser" ], "WebGUI::VersionTag" : [ "WebGUI::Workflow::Activity::CommitVersionTag", diff --git a/lib/WebGUI/Workflow/Activity/ActivateUser.pm b/lib/WebGUI/Workflow/Activity/ActivateUser.pm new file mode 100644 index 000000000..f043e6826 --- /dev/null +++ b/lib/WebGUI/Workflow/Activity/ActivateUser.pm @@ -0,0 +1,77 @@ +package WebGUI::Workflow::Activity::ActivateUser; + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2009 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + +use strict; +use base 'WebGUI::Workflow::Activity'; + +=head1 NAME + +Package WebGUI::Workflow::Activity::ActivateUser + +=head1 DESCRIPTION + +Activates a WebGUI user + +=head1 SYNOPSIS + +See WebGUI::Workflow::Activity for details on how to use any activity. + +=head1 METHODS + +These methods are available from this class: + +=cut + +#------------------------------------------------------------------- + +=head2 definition ( session, definition ) + +See WebGUI::Workflow::Activity::defintion() for details. + +=cut + +sub definition { + my $class = shift; + my $session = shift; + my $definition = shift; + my $i18n = WebGUI::International->new($session, "WebGUI"); + push(@{$definition}, { + name => $i18n->get("activate user"), + properties=> {}, + }); + return $class->SUPER::definition($session,$definition); +} + +#------------------------------------------------------------------- + +=head2 execute ( [ object ] ) + +See WebGUI::Workflow::Activity::execute() for details. + +=cut + +sub execute { + my $self = shift; + my $user = shift; + my $instance = shift; + + $user->enable; + return $self->COMPLETE; +} + +1; + +#vim:ft=perl diff --git a/lib/WebGUI/Workflow/Activity/DeactivateUser.pm b/lib/WebGUI/Workflow/Activity/DeactivateUser.pm new file mode 100644 index 000000000..1ae94ae24 --- /dev/null +++ b/lib/WebGUI/Workflow/Activity/DeactivateUser.pm @@ -0,0 +1,77 @@ +package WebGUI::Workflow::Activity::DeactivateUser; + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2009 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + +use strict; +use base 'WebGUI::Workflow::Activity'; + +=head1 NAME + +Package WebGUI::Workflow::Activity::DeactivateUser + +=head1 DESCRIPTION + +Dectivates a WebGUI user + +=head1 SYNOPSIS + +See WebGUI::Workflow::Activity for details on how to use any activity. + +=head1 METHODS + +These methods are available from this class: + +=cut + +#------------------------------------------------------------------- + +=head2 definition ( session, definition ) + +See WebGUI::Workflow::Activity::defintion() for details. + +=cut + +sub definition { + my $class = shift; + my $session = shift; + my $definition = shift; + my $i18n = WebGUI::International->new($session, "WebGUI"); + push(@{$definition}, { + name => $i18n->get("deactivate user"), + properties=> {}, + }); + return $class->SUPER::definition($session,$definition); +} + +#------------------------------------------------------------------- + +=head2 execute ( [ object ] ) + +See WebGUI::Workflow::Activity::execute() for details. + +=cut + +sub execute { + my $self = shift; + my $user = shift; + my $instance = shift; + + $user->disable; + return $self->COMPLETE; +} + +1; + +#vim:ft=perl diff --git a/lib/WebGUI/Workflow/Activity/DeleteUser.pm b/lib/WebGUI/Workflow/Activity/DeleteUser.pm new file mode 100644 index 000000000..2a4b8e2d3 --- /dev/null +++ b/lib/WebGUI/Workflow/Activity/DeleteUser.pm @@ -0,0 +1,79 @@ +package WebGUI::Workflow::Activity::DeleteUser; + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2009 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + +use strict; +use base 'WebGUI::Workflow::Activity'; + +=head1 NAME + +Package WebGUI::Workflow::Activity::DeleteUser + +=head1 DESCRIPTION + +Deletes a WebGUI user + +=head1 SYNOPSIS + +See WebGUI::Workflow::Activity for details on how to use any activity. + +=head1 METHODS + +These methods are available from this class: + +=cut + +#------------------------------------------------------------------- + +=head2 definition ( session, definition ) + +See WebGUI::Workflow::Activity::defintion() for details. + +=cut + +sub definition { + my $class = shift; + my $session = shift; + my $definition = shift; + my $i18n = WebGUI::International->new($session, "WebGUI"); + push(@{$definition}, { + name => $i18n->get("delete user"), + properties=> {}, + }); + return $class->SUPER::definition($session,$definition); +} + +#------------------------------------------------------------------- + +=head2 execute ( [ object ] ) + +See WebGUI::Workflow::Activity::execute() for details. + +=cut + +sub execute { + my $self = shift; + my $user = shift; + my $instance = shift; + + $instance->delete; + $user->delete; + + return $self->COMPLETE; +} + +1; + +#vim:ft=perl diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 4f945cd68..d248f2e71 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -4451,6 +4451,18 @@ Users may override this setting in their profile. lastUpdated => 1242438244, }, + 'activate user' => { + message => 'Activate User', + }, + + 'deactivate user' => { + message => 'Deactivate User', + }, + + 'delete user' => { + message => 'Delete User', + }, + }; 1;