Documentation is so rad.
This commit is contained in:
parent
7171aa05ed
commit
480d7c47cf
5 changed files with 20 additions and 3 deletions
|
|
@ -35,7 +35,7 @@ app/controllers/aspects_controller.rb a1d388f76b63ceeb7a6bfca489180a3c8d8147d5
|
||||||
app/helpers/markdownify_helper.rb 144de1c8e41cd9ea62b9f2bfd5e01d3e270db2b7
|
app/helpers/markdownify_helper.rb 144de1c8e41cd9ea62b9f2bfd5e01d3e270db2b7
|
||||||
app/helpers/publics_helper.rb 391ae86656d7542f99057baf4e54384e98fc5976
|
app/helpers/publics_helper.rb 391ae86656d7542f99057baf4e54384e98fc5976
|
||||||
lib/rake_helpers.rb 6dcf44ace70c72350ed647e35a97ce89fd90f975
|
lib/rake_helpers.rb 6dcf44ace70c72350ed647e35a97ce89fd90f975
|
||||||
lib/diaspora/encryptable.rb 2222d77333b74fa18fd34baf1434c84aa138ad3c
|
lib/diaspora/encryptable.rb 1546637e5d086c1d8c53214a94be9387cc6ab50d
|
||||||
app/mailers/notifier.rb 1a98e17916d3a63b1cee8cd2c13174e303521157
|
app/mailers/notifier.rb 1a98e17916d3a63b1cee8cd2c13174e303521157
|
||||||
lib/diaspora/parser.rb cfb7f7f797b43fa57ae507527f32fc96801dda1c
|
lib/diaspora/parser.rb cfb7f7f797b43fa57ae507527f32fc96801dda1c
|
||||||
app/models/request.rb 6ba9fafc1eed807fc9bb70f1eb80c44485c78128
|
app/models/request.rb 6ba9fafc1eed807fc9bb70f1eb80c44485c78128
|
||||||
|
|
@ -118,7 +118,7 @@ app/models/jobs/update_service_users.rb 87d8fb174d9a3f2402b76dff098af30c9e62c6bb
|
||||||
app/controllers/contacts_controller.rb 6e51e74f08eb8d476d0252ff68b8aa9c0d6a7847
|
app/controllers/contacts_controller.rb 6e51e74f08eb8d476d0252ff68b8aa9c0d6a7847
|
||||||
app/helpers/comments_helper.rb e4bb2ef4b1d4abba48c792f4f2ae245d8b958a8b
|
app/helpers/comments_helper.rb e4bb2ef4b1d4abba48c792f4f2ae245d8b958a8b
|
||||||
app/models/jobs/notify_local_users.rb f1a552240566e61912b276d964ce907fcb97c5d0
|
app/models/jobs/notify_local_users.rb f1a552240566e61912b276d964ce907fcb97c5d0
|
||||||
lib/diaspora/relayable.rb be1958fee031be5ba9a985976aac36d62e71ea9f
|
lib/diaspora/relayable.rb ffef93646ef927ce597441c51ecdc0246a721fbf
|
||||||
lib/diaspora/ostatus_builder.rb e19d782a0f9776a1758f87dd17c5d589e176a9e1
|
lib/diaspora/ostatus_builder.rb e19d782a0f9776a1758f87dd17c5d589e176a9e1
|
||||||
app/models/jobs/socket_webfinger.rb 4c3a50bff8c51007108dcb4ffd277a1f20b05a36
|
app/models/jobs/socket_webfinger.rb 4c3a50bff8c51007108dcb4ffd277a1f20b05a36
|
||||||
app/models/services/facebook.rb 289d3f2c968bb9d4d6a4183b4fd71816d7e2b680
|
app/models/services/facebook.rb 289d3f2c968bb9d4d6a4183b4fd71816d7e2b680
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -44,7 +44,6 @@ class User < ActiveRecord::Base
|
||||||
person.save if person && person.changed?
|
person.save if person && person.changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
attr_accessible :getting_started, :password, :password_confirmation, :language, :disable_mail
|
attr_accessible :getting_started, :password, :password_confirmation, :language, :disable_mail
|
||||||
|
|
||||||
def update_user_preferences(pref_hash)
|
def update_user_preferences(pref_hash)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
module Diaspora
|
module Diaspora
|
||||||
module Encryptable
|
module Encryptable
|
||||||
|
# Check that signature is a correct signature of #signable_string by person
|
||||||
|
#
|
||||||
|
# @param [String] signature The signature to be verified.
|
||||||
|
# @param [Person] person The signer.
|
||||||
|
# @return [Boolean]
|
||||||
def verify_signature(signature, person)
|
def verify_signature(signature, person)
|
||||||
if person.nil?
|
if person.nil?
|
||||||
Rails.logger.info("event=verify_signature status=abort reason=no_person guid=#{self.guid}")
|
Rails.logger.info("event=verify_signature status=abort reason=no_person guid=#{self.guid}")
|
||||||
|
|
@ -18,6 +23,8 @@ module Diaspora
|
||||||
validity
|
validity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @param [OpenSSL::PKey::RSA] key An RSA key
|
||||||
|
# @return [String] A Base64 encoded signature of #signable_string with key
|
||||||
def sign_with_key(key)
|
def sign_with_key(key)
|
||||||
sig = Base64.encode64(key.sign "SHA", signable_string)
|
sig = Base64.encode64(key.sign "SHA", signable_string)
|
||||||
log_hash = {:event => :sign_with_key, :status => :complete}
|
log_hash = {:event => :sign_with_key, :status => :complete}
|
||||||
|
|
@ -26,6 +33,7 @@ module Diaspora
|
||||||
sig
|
sig
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @return [Array<String>] The ROXML attrs other than author_signature and parent_author_signature.
|
||||||
def signable_accessors
|
def signable_accessors
|
||||||
accessors = self.class.roxml_attrs.collect do |definition|
|
accessors = self.class.roxml_attrs.collect do |definition|
|
||||||
definition.accessor
|
definition.accessor
|
||||||
|
|
@ -36,12 +44,15 @@ module Diaspora
|
||||||
accessors
|
accessors
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @return [String] Defaults to the ROXML attrs which are not signatures.
|
||||||
def signable_string
|
def signable_string
|
||||||
signable_accessors.collect{ |accessor|
|
signable_accessors.collect{ |accessor|
|
||||||
(self.send accessor.to_sym).to_s
|
(self.send accessor.to_sym).to_s
|
||||||
}.join(';')
|
}.join(';')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @abstract
|
||||||
|
# @return [String]
|
||||||
#def signable_string
|
#def signable_string
|
||||||
# raise NotImplementedError.new("Implement this in your encryptable class")
|
# raise NotImplementedError.new("Implement this in your encryptable class")
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ module Diaspora
|
||||||
def parent_guid
|
def parent_guid
|
||||||
self.parent.guid
|
self.parent.guid
|
||||||
end
|
end
|
||||||
|
|
||||||
def parent_guid= new_parent_guid
|
def parent_guid= new_parent_guid
|
||||||
self.parent = parent_class.where(:guid => new_parent_guid).first
|
self.parent = parent_class.where(:guid => new_parent_guid).first
|
||||||
end
|
end
|
||||||
|
|
@ -82,14 +83,20 @@ module Diaspora
|
||||||
verify_signature(self.author_signature, self.author)
|
verify_signature(self.author_signature, self.author)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @abstract
|
||||||
|
# @return [Class]
|
||||||
def parent_class
|
def parent_class
|
||||||
raise NotImplementedError.new('you must override parent_class in order to enable relayable on this model')
|
raise NotImplementedError.new('you must override parent_class in order to enable relayable on this model')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @abstract
|
||||||
|
# @return An instance of Relayable#parent_class
|
||||||
def parent
|
def parent
|
||||||
raise NotImplementedError.new('you must override parent in order to enable relayable on this model')
|
raise NotImplementedError.new('you must override parent in order to enable relayable on this model')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @abstract
|
||||||
|
# @param parent An instance of Relayable#parent_class
|
||||||
def parent= parent
|
def parent= parent
|
||||||
raise NotImplementedError.new('you must override parent= in order to enable relayable on this model')
|
raise NotImplementedError.new('you must override parent= in order to enable relayable on this model')
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue