From 0125b04e10dd4651bcc61f1aeb813fe26bb7c53f Mon Sep 17 00:00:00 2001 From: Gabriel Silva Date: Thu, 28 Jul 2016 16:57:41 +0000 Subject: [PATCH] Adds Noosfero and Twitter auth classes --- plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb | 15 +++++++++++++++ plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb | 7 +++++++ 2 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb create mode 100644 plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb diff --git a/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb b/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb new file mode 100644 index 0000000..cb468b8 --- /dev/null +++ b/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb @@ -0,0 +1,15 @@ +class OauthClientPlugin::NoosferoOauth2Auth < OauthClientPlugin::Auth + + def image_url(size = nil) + size = IMAGE_SIZES[size] || IMAGE_SIZES[:icon] + URI.join("http://#{self.external_person.source}/profile/#{self.external_person.identifier}/", size) + end + + def profile_url + "http://#{self.external_person.source}/profile/#{self.external_person.identifier}" + end + + def settings_url + "http://#{self.external_person.source}/myprofile/#{self.external_person.identifier}" + end +end diff --git a/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb b/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb new file mode 100644 index 0000000..ec3d47c --- /dev/null +++ b/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb @@ -0,0 +1,7 @@ +class OauthClientPlugin::TwitterAuth < OauthClientPlugin::Auth + + def image_url(size = nil) + size = IMAGE_SIZES[size] || IMAGE_SIZES[:icon] + self.external_person_image_url + end +end -- libgit2 0.21.2