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

sartak at bestpractical.com sartak at bestpractical.com
Wed May 20 19:04:16 EDT 2009


The branch, master has been updated
       via  f138cf8272527f101270fbd40821ce90effd8562 (commit)
       via  80c9a06ac19762ccd17852c5043b56601f0bfccc (commit)
      from  cd29d40c0b5f2bcc675e84e363e94ad92c24e007 (commit)

Summary of changes:
 lib/App/Changeloggr/CurrentUser.pm     |   16 ++++++++++++++++
 lib/App/Changeloggr/Model/Changelog.pm |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 lib/App/Changeloggr/CurrentUser.pm

- Log -----------------------------------------------------------------
commit 80c9a06ac19762ccd17852c5043b56601f0bfccc
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed May 20 19:03:52 2009 -0400

    Add a CurrentUser class with an is_staff method

diff --git a/lib/App/Changeloggr/CurrentUser.pm b/lib/App/Changeloggr/CurrentUser.pm
new file mode 100644
index 0000000..e87267b
--- /dev/null
+++ b/lib/App/Changeloggr/CurrentUser.pm
@@ -0,0 +1,16 @@
+package App::Changeloggr::CurrentUser;
+use strict;
+use warnings;
+use base 'Jifty::CurrentUser';
+
+sub is_staff {
+    my $self = shift;
+
+    my $user = $self->user_object
+        or return 0;
+
+    return $user->access_level eq 'staff';
+}
+
+1;
+

commit f138cf8272527f101270fbd40821ce90effd8562
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed May 20 19:04:05 2009 -0400

    current_user_is_admin if current_user->is_staff

diff --git a/lib/App/Changeloggr/Model/Changelog.pm b/lib/App/Changeloggr/Model/Changelog.pm
index 8efe90a..bcd5a13 100644
--- a/lib/App/Changeloggr/Model/Changelog.pm
+++ b/lib/App/Changeloggr/Model/Changelog.pm
@@ -187,6 +187,7 @@ sub current_user_is_admin {
 
     return 1 if Jifty->config->framework('DevelMode');
     return 1 if Jifty->web->current_user->id == $self->owner->id;
+    return 1 if Jifty->web->current_user->is_staff;
 
     my $changelog_admin = App::Changeloggr::Model::ChangelogAdmin->new(
         current_user => App::Changeloggr::CurrentUser->superuser,

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



More information about the Bps-public-commit mailing list