[Bps-public-commit] App-Changeloggr branch, master, updated. a97bb9ce99b476e389ae3a90fa0987a6e9b62243

sartak at bestpractical.com sartak at bestpractical.com
Thu Feb 26 23:36:54 EST 2009


The branch, master has been updated
       via  a97bb9ce99b476e389ae3a90fa0987a6e9b62243 (commit)
      from  e1f6883e99204c66cf4ce4389d9d15f2d6640696 (commit)

Summary of changes:
 .../{UpdateChangelog.pm => DeleteChangelog.pm}     |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
 copy lib/App/Changeloggr/Action/{UpdateChangelog.pm => DeleteChangelog.pm} (79%)

- Log -----------------------------------------------------------------
commit a97bb9ce99b476e389ae3a90fa0987a6e9b62243
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Feb 26 23:36:41 2009 -0500

    Delete action that confirms that you have an admin_token

diff --git a/lib/App/Changeloggr/Action/DeleteChangelog.pm b/lib/App/Changeloggr/Action/DeleteChangelog.pm
new file mode 100644
index 0000000..4138563
--- /dev/null
+++ b/lib/App/Changeloggr/Action/DeleteChangelog.pm
@@ -0,0 +1,27 @@
+package App::Changeloggr::Action::DeleteChangelog;
+use strict;
+use warnings;
+use base 'Jifty::Action::Record::Delete';
+
+sub record_class { 'App::Changeloggr::Model::Changelog' }
+
+sub validate_admin_token {
+    my $self        = shift;
+    my $admin_token = shift;
+
+    if ($self->record->as_superuser->admin_token eq ($admin_token||'')) {
+        return $self->validation_ok('admin_token');
+    }
+    else {
+        return $self->validation_error(admin_token => "You do not have permission to delete this changelog.");
+    }
+}
+
+sub take_action {
+    my $self = shift;
+    $self->record->current_user(App::Changeloggr::CurrentUser->superuser);
+    $self->SUPER::take_action(@_);
+}
+
+1;
+

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list