[Bps-public-commit] jifty-plugin-authentication-twitter branch, master, updated. a9d67aa530ad04ca17ad1f48d1596189360f72d1

Shawn Moore sartak at bestpractical.com
Tue Jun 8 12:28:44 EDT 2010


The branch, master has been updated
       via  a9d67aa530ad04ca17ad1f48d1596189360f72d1 (commit)
      from  e1f2be02b2e35c27c7f7725f063260eda2ec5b90 (commit)

Summary of changes:
 .../Authentication/Twitter/Model/TwitterAccount.pm |   70 ++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 lib/Jifty/Plugin/Authentication/Twitter/Model/TwitterAccount.pm

- Log -----------------------------------------------------------------
commit a9d67aa530ad04ca17ad1f48d1596189360f72d1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Jun 8 12:29:33 2010 -0400

    First cut of a TwitterAccount model

diff --git a/lib/Jifty/Plugin/Authentication/Twitter/Model/TwitterAccount.pm b/lib/Jifty/Plugin/Authentication/Twitter/Model/TwitterAccount.pm
new file mode 100644
index 0000000..0dbf9b8
--- /dev/null
+++ b/lib/Jifty/Plugin/Authentication/Twitter/Model/TwitterAccount.pm
@@ -0,0 +1,70 @@
+use strict;
+use warnings;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Twitter::Model::TwitterAccount
+
+=head1 DESCRIPTION
+
+Represents a relation between a user and a Twitter account.
+
+=cut
+
+package Jifty::Plugin::Authentication::Twitter::Model::TwitterAccount;
+use Jifty::DBI::Schema;
+
+use Jifty::Record schema {
+
+column user_id =>
+  is mandatory,
+  label is 'User',
+  is protected;
+
+column twitter_id =>
+  is mandatory,
+  is protected;
+
+column screen_name =>
+  label is 'Twitter name',
+  default is '',
+  type is 'varchar';
+
+column access_token =>
+  type is 'varchar';
+  label is 'OAuth access token',
+  is protected;
+
+column access_secret =>
+  type is 'varchar';
+  label is 'OAuth access token secret',
+  is protected;
+
+column created_on =>
+  type is 'date',
+  filters are 'Jifty::DBI::Filter::Date',
+  label is 'Created on',
+  since '0.2.69',
+  default is defer { DateTime->now },
+  is protected;
+
+};
+
+=head2 current_user_can
+
+Only root may have access to this model.
+
+In the near future, we should allow the authorizing user to edit this account
+(taking care of course that the authorizing user is not actually authed via
+OAuth!)
+
+=cut
+
+sub current_user_can {
+    my $self = shift;
+
+    return $self->current_user->is_superuser;
+}
+1;
+
+

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



More information about the Bps-public-commit mailing list