talia_core 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/VERSION.yml +1 -1
  2. data/generators/generator_helpers.rb +35 -2
  3. data/generators/talia_admin/talia_admin_generator.rb +6 -0
  4. data/generators/talia_admin/templates/controllers/admin/background_controller.rb +2 -0
  5. data/generators/talia_admin/templates/controllers/admin/roles_controller.rb +8 -0
  6. data/generators/talia_admin/templates/controllers/admin/sources_controller.rb +2 -64
  7. data/generators/talia_admin/templates/controllers/admin/users_controller.rb +3 -41
  8. data/generators/talia_admin/templates/controllers/admin_controller.rb +1 -1
  9. data/generators/talia_admin/templates/helpers/admin/roles_helper.rb +2 -0
  10. data/generators/talia_admin/templates/helpers/admin/users_helper.rb +9 -0
  11. data/generators/talia_admin/templates/helpers/admin_helper.rb +19 -0
  12. data/generators/{talia_base → talia_admin}/templates/migrations/populate_users.rb +5 -2
  13. data/generators/talia_admin/templates/models/role.rb +3 -0
  14. data/generators/talia_admin/templates/public/stylesheets/backend.css +1 -4
  15. data/generators/talia_admin/templates/views/admin/index.html.erb +3 -3
  16. data/generators/talia_admin/templates/views/admin/sources/_show.html.erb +13 -0
  17. data/generators/talia_admin/templates/views/layouts/admin.html.erb +5 -5
  18. data/generators/talia_base/talia_base_generator.rb +11 -18
  19. data/generators/talia_base/templates/README +15 -0
  20. data/generators/talia_base/templates/app/controllers/sources_controller.rb +125 -7
  21. data/generators/talia_base/templates/app/helpers/sources_helper.rb +19 -35
  22. data/generators/talia_base/templates/app/views/sources/index.html.erb +12 -1
  23. data/generators/talia_base/templates/app/views/sources/semantic_templates/default/default.html.erb +21 -0
  24. data/generators/talia_base/templates/app/views/sources/semantic_templates/default/province.html.erb +19 -0
  25. data/generators/talia_base/templates/config/routes.rb +24 -4
  26. data/generators/talia_base/templates/script/setup_talia_backend +35 -0
  27. data/lib/loader_helper.rb +8 -1
  28. data/lib/talia_core/active_source.rb +9 -6
  29. data/lib/talia_core/active_source_parts/class_methods.rb +2 -1
  30. data/lib/talia_core/active_source_parts/predicate_handler.rb +12 -0
  31. data/lib/talia_core/active_source_parts/rdf.rb +1 -1
  32. data/lib/talia_core/data_types/iip_loader.rb +2 -0
  33. data/lib/talia_core/dc_resource.rb +1 -1
  34. data/lib/talia_core/initializer.rb +2 -0
  35. data/lib/talia_core/semantic_relation.rb +1 -1
  36. data/lib/talia_util/rake_tasks.rb +2 -2
  37. data/lib/talia_util/util.rb +1 -1
  38. data/test/talia_core/active_source_predicate_test.rb +2 -6
  39. data/test/talia_core/active_source_rdf_test.rb +9 -5
  40. data/test/talia_core/active_source_test.rb +50 -44
  41. data/test/talia_core/data_types/data_loader_test.rb +2 -2
  42. data/test/talia_core/data_types/data_record_test.rb +1 -1
  43. data/test/talia_core/data_types/file_record_test.rb +4 -3
  44. data/test/talia_core/data_types/iip_data_test.rb +2 -2
  45. data/test/talia_core/data_types/image_data_test.rb +1 -1
  46. data/test/talia_core/data_types/pdf_data_test.rb +1 -1
  47. data/test/talia_core/data_types/xml_data_test.rb +3 -2
  48. data/test/talia_core/initializer_test.rb +1 -1
  49. data/test/talia_core/ordered_source_test.rb +1 -5
  50. data/test/talia_core/rdf_resource_test.rb +1 -5
  51. data/test/talia_core/semantic_collection_item_test.rb +3 -7
  52. data/test/talia_core/source_test.rb +7 -12
  53. data/test/talia_core/workflow/publication_workflow_test.rb +36 -23
  54. data/test/talia_util/import_job_helper_test.rb +1 -5
  55. data/test/test_helper.rb +18 -5
  56. metadata +11 -52
  57. data/generators/talia_admin/templates/test/fixtures/users.yml +0 -32
  58. data/generators/talia_admin/templates/test/unit/user_test.rb +0 -134
  59. data/generators/talia_admin/templates/views/admin/sources/_data.html.erb +0 -6
  60. data/generators/talia_admin/templates/views/admin/sources/_data_form.html.erb +0 -15
  61. data/generators/talia_admin/templates/views/admin/sources/_form.html.erb +0 -7
  62. data/generators/talia_admin/templates/views/admin/sources/_list.html.erb +0 -3
  63. data/generators/talia_admin/templates/views/admin/sources/_notice.html.erb +0 -1
  64. data/generators/talia_admin/templates/views/admin/sources/_predicate.html.erb +0 -22
  65. data/generators/talia_admin/templates/views/admin/sources/_predicates.html.erb +0 -15
  66. data/generators/talia_admin/templates/views/admin/sources/_sources.html.erb +0 -17
  67. data/generators/talia_admin/templates/views/admin/sources/_upload.html.erb +0 -6
  68. data/generators/talia_admin/templates/views/admin/sources/edit.html.erb +0 -6
  69. data/generators/talia_admin/templates/views/admin/sources/index.html.erb +0 -5
  70. data/generators/talia_admin/templates/views/admin/users/_form.html.erb +0 -10
  71. data/generators/talia_admin/templates/views/admin/users/_form_roles.html.erb +0 -8
  72. data/generators/talia_admin/templates/views/admin/users/edit.html.erb +0 -12
  73. data/generators/talia_admin/templates/views/admin/users/index.html.erb +0 -22
  74. data/generators/talia_admin/templates/views/admin/users/new.html.erb +0 -5
  75. data/generators/talia_admin/templates/views/admin/users/show.html.erb +0 -6
  76. data/generators/talia_base/templates/app/controllers/sessions_controller.rb +0 -90
  77. data/generators/talia_base/templates/app/controllers/source_data/show.html.erb +0 -2
  78. data/generators/talia_base/templates/app/helpers/source_data/show.html.erb +0 -2
  79. data/generators/talia_base/templates/app/views/sessions/new.html.erb +0 -33
  80. data/generators/talia_base/templates/migrations/create_open_id.rb +0 -26
  81. data/generators/talia_base/templates/migrations/create_roles.rb +0 -20
  82. data/generators/talia_base/templates/migrations/create_sessions.rb +0 -16
  83. data/generators/talia_base/templates/migrations/create_users.rb +0 -20
  84. data/lib/role.rb +0 -12
  85. data/lib/talia_cl/command_line.rb +0 -39
  86. data/lib/talia_cl/commands/standalone/cl_options.rb +0 -9
  87. data/lib/talia_cl/commands/standalone/standalone_generate.rb +0 -75
  88. data/lib/talia_cl/commands/standalone.rb +0 -25
  89. data/lib/talia_cl/commands/talia_console/cl_options.rb +0 -55
  90. data/lib/talia_cl/commands/talia_console/console_commands.rb +0 -37
  91. data/lib/talia_cl/commands/talia_console/talia_commands.rb +0 -131
  92. data/lib/talia_cl/commands/talia_console.rb +0 -47
  93. data/lib/talia_cl/core_commands.rb +0 -11
  94. data/lib/talia_cl.rb +0 -47
  95. data/lib/user.rb +0 -116
@@ -1,75 +0,0 @@
1
- require 'ftools'
2
- require 'fileutils'
3
-
4
- # This is used to create a skeleton directory with the necessary
5
- # files to set up a standalone Talia application.
6
- module TaliaCommandLine
7
-
8
- class << self
9
-
10
- # Create a standalone installation directory for Talia
11
- def create_standalone(directory)
12
- if(File.exist?(directory))
13
- puts "The target directory already exists: #{directory}"
14
- return -1
15
- end
16
-
17
- begin
18
- puts("Creating Talia standalone in #{directory}")
19
- File.makedirs(directory)
20
-
21
- # Copy the rake task extensions
22
- copy_dir(directory, "tasks")
23
-
24
- # Copy the rakefile
25
- copy_file(directory, "", File.join('standalone_templates', 'Rakefile'), 'Rakefile')
26
-
27
- # copy the config directory
28
- File.makedirs(File.join(directory, "config"))
29
- copy_file(directory, "config", "database.yml.example", "database.yml")
30
- copy_file(directory, "config", "r„dfstore.yml.redland_example", "rdfstore.yml")
31
- copy_file(directory, "config", "talia_core.yml.example", "talia_core.yml")
32
- rescue
33
- puts "Error creating. Removing files."
34
- FileUtils.rm_rf(directory)
35
- raise
36
- end
37
- end
38
-
39
- protected
40
-
41
-
42
- # This goes to the root directory for the "shared" templates. (The ones
43
- # contained in the talia generators.
44
- def core_root
45
- File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "..", "..")
46
- end
47
-
48
-
49
- # Recursively copies a directory of template files.
50
- def copy_dir(targetdir, dirname)
51
- puts "Processing directory #{dirname}"
52
- targetdir = dirname unless(targetdir)
53
- File.makedirs(File.join(targetdir, dirname))
54
- Dir["#{File.join(core_root, dirname)}/**"].each do |file|
55
- unless(file =~ /^\..*/) # exclude hidden/directory files
56
- if(File.directory?(file))
57
- copy_dir(targetdir, File.join(dirname, File.basename(file)))
58
- else
59
- copy_file(targetdir, dirname, File.basename(file))
60
- end
61
- end
62
- end
63
- end
64
-
65
- # Copies a file to the new target directory in the given path
66
- def copy_file(targetdir, relative_path, name, target_name = nil)
67
- source = File.join(core_root, relative_path, name)
68
- target_name = name unless(target_name)
69
- target = File.join(targetdir, relative_path, target_name)
70
- File.cp(source, target)
71
- puts "Copied #{File.join(relative_path, name)} to #{target_name}"
72
- end
73
-
74
- end
75
- end
@@ -1,25 +0,0 @@
1
- # Define the command for generating a standalone Talia application
2
- module TaliaCommandLine
3
-
4
- desc "Generate a standalone application"
5
- command(:standalone) do
6
- # Loader file for the talia console
7
- $: << File.join(File.expand_path(File.dirname(__FILE__)), "standalone")
8
-
9
- require 'cl_options'
10
- require 'standalone_generate'
11
-
12
- directory = ARGV.shift
13
-
14
- unless(directory)
15
- puts("No directory given. Please use 'talia standalone <directory> [options]'")
16
- exit -1
17
- end
18
-
19
- # flags = TaliaCommands::flags
20
-
21
- create_standalone(directory)
22
- end
23
-
24
- end
25
-
@@ -1,55 +0,0 @@
1
- require 'rubygems'
2
- gem 'optiflag'
3
- require 'optiflag'
4
-
5
- # Parse for the command line
6
- module TaliaCommands extend OptiFlagSet
7
-
8
- optional_flag "talia_root" do
9
- description "Path to the TALIA_ROOT. (default: automatic)"
10
- one_arg
11
- end
12
-
13
- optional_flag "talia_config" do
14
- description "Talia configuration file name. (default: talia_core.yml)"
15
- one_arg
16
- end
17
-
18
- optional_flag "environment" do
19
- description "Environment for connections. (default: devlopement)"
20
- one_arg
21
- end
22
-
23
- optional_switch_flag "reset_db" do
24
- description "Reset the database"
25
- end
26
-
27
- optional_switch_flag "reset_rdf" do
28
- description "Reset the RDF store"
29
- end
30
-
31
- optional_switch_flag "verbose" do
32
- description "Turn on the verbose mode"
33
- end
34
-
35
- optional_switch_flag "noinit" do
36
- description "Do not initialize the Talia core"
37
- end
38
-
39
- and_process!
40
-
41
- # Putting the flags into the environment, and remove them to avoid
42
- # having them interpreted by irb
43
- flags.each do |flag, content|
44
- my_content = content
45
- my_content = "yes" if(content == true)
46
- ENV[flag.to_s] = my_content
47
- killed = ARGV.index("-#{flag}") # Delete the flag
48
- if(killed)
49
- ARGV.delete_at(killed + 1) if(content.is_a?(String)) # delete the parameter, if there is one
50
- ARGV.delete_at(killed)
51
- end
52
- end
53
-
54
- # puts ENV.each { |k,v| puts "#{k} - #{v}"} if(flags[:verbose])
55
- end
@@ -1,37 +0,0 @@
1
- # This adds the console commands for the talia console
2
-
3
- module TaliaCommandLine
4
-
5
- # Array with command descriptions
6
- @console_commands = Array.new
7
-
8
- # Add a new console command
9
- def self.console(command, &command_block)
10
- # Add the description
11
- description = @desc ? @desc : "Generic command: #{command}"
12
- @desc = nil
13
- @console_commands << [command.to_s, description]
14
-
15
- command = command.to_sym
16
-
17
- (class << MAIN_OBJECT; self; end).class_eval do
18
- define_method(command, command_block)
19
- end
20
- end
21
-
22
- # Add an instance variable
23
- def self.to_var(name, value)
24
- (class << MAIN_OBJECT; self; end).class_eval do
25
- raise(RuntimeError, "Method already defined: #{name}") if(method_defined?(name))
26
- define_method(name) { value }
27
- end
28
- value
29
- end
30
-
31
- # Returns the defined console commands
32
- def self.console_commands
33
- @console_commands
34
- end
35
-
36
- end
37
-
@@ -1,131 +0,0 @@
1
- # Create the commands for the Talia console
2
- require 'console_commands'
3
-
4
- module TaliaCommandLine
5
-
6
- desc "Show help on the talia console commands"
7
- console(:thelp) do
8
- puts "Talia console commands:\n\n"
9
- TaliaCommandLine::console_commands.each do |command|
10
- puts "#{command[0]}\t- #{command[1]}"
11
- end
12
- nil
13
- end
14
-
15
- desc "Get all sources"
16
- console(:sources) do
17
- TaliaCore::Source.find(:all)
18
- end
19
-
20
- desc "Find a source by local uri"
21
- console(:tsrc) do |uri|
22
- TaliaCore::Source.find(N::LOCAL + uri)
23
- end
24
-
25
- desc "Add a RDF source adapter. Result set to 'adapter'. Use: :type, option => ..."
26
- console(:rdf_source) do |type, options|
27
- options[:type] = type
28
- to_var :adapter, ConnectionPool.add_data_source(options)
29
- end
30
-
31
- desc "Drop RDF data sources."
32
- console(:rdf_down) do
33
- ConnectionPool.clear
34
- end
35
-
36
- desc "Create a RDFS::Resource. Result set to 'res'"
37
- console(:resource) do |uri|
38
- to_var :res, RDFS::Resource.new(uri)
39
- end
40
-
41
- desc "Print the given element"
42
- console(:tprint) do |element|
43
- puts element.class
44
- if(element.kind_of?(TaliaCore::Source))
45
- puts "Source: #{element.uri}"
46
- puts "Name: #{element.name}m"
47
- element.direct_predicates.each do |pred|
48
- puts "#{pred.to_name_s}:"
49
- pred.each { |val| puts val}
50
- end
51
- elsif(element.kind_of?(RDFS::Resource))
52
- puts "RDFS::Resource #{element.uri}"
53
- element.direct_predicates.each do |pred|
54
- puts "#{pred.uri}:"
55
- element[pred.uri].each { |val| puts "\t#{Uri.new(val).to_name_s}\n\n" }
56
- end
57
- elsif(element.kind_of?(String))
58
- puts element
59
- elsif(element.respond_to?("each"))
60
- element.each { |el| puts el.to_s }
61
- else
62
- puts "Unknown type: #{element.class}"
63
- end
64
- nil
65
- end
66
-
67
- desc "Print the rdf types"
68
- console(:put_types) do
69
- N::SourceClass.rdf_types.each do |type|
70
- puts type.to_name_s
71
- end
72
- nil
73
- end
74
-
75
- desc "Import into the Talia store. Can be called with {rdf|data|yaml} as parameter"
76
- console(:talia_import) do |type|
77
- unless(type)
78
- print "Import which type? (rdf|data|yaml) : "
79
- type = readline
80
- end
81
- type = type.to_s.strip
82
- print "Enter file pattern: "
83
- filepattern = readline
84
- case(type)
85
- when "rdf":
86
- print "Select data file format (ntriples|rdfxml): "
87
- dataformat = readline
88
- RdfImport::import(dataformat, FileList.new(filepattern))
89
- when "yaml":
90
- YamlImport::import_multi_files(FileList.new(filepattern))
91
- when "data":
92
- print "Select data type to import: "
93
- datatype = readline
94
- DataImport::import(FileList.new(filepattern), datatype)
95
- end
96
- end
97
-
98
- desc "Quick query for sources. Use nil as a placeholder"
99
- console(:tquery) do |subject, predicate, object|
100
- variables = []
101
- q_subject = if(subject)
102
- RDFS::Resource.new(N::URI::make_uri(subject).to_s)
103
- else
104
- variables << :s
105
- :s
106
- end
107
- q_predicate = if(predicate)
108
- RDFS::Resource.new(N::URI::make_uri(predicate).to_s)
109
- else
110
- variables << :p
111
- :p
112
- end
113
- q_object = if(object)
114
- if(object.include?(":"))
115
- RDFS::Resource.new(N::URI::make_uri(object).to_s)
116
- else
117
- object
118
- end
119
- else
120
- variables << :o
121
- :o
122
- end
123
- my_query = Query.new.select(*variables).distinct
124
- my_query.where(q_subject, q_predicate, q_object)
125
- puts "SPARQL: #{Query2SPARQL.translate(my_query)}"
126
- puts ""
127
- my_query.execute
128
- end
129
- end
130
-
131
-
@@ -1,47 +0,0 @@
1
- # We just capture the main object for later reuse, as a workaround for adding
2
- # the command line commands to it.
3
- MAIN_OBJECT = self
4
-
5
- # Define the command for the Talia console
6
- module TaliaCommandLine
7
-
8
- desc "Start the Talia console"
9
- command(:console) do
10
- # Loader file for the talia console
11
- $: << File.join(File.expand_path(File.dirname(__FILE__)), "talia_console")
12
-
13
- # Console modules
14
- require "talia_commands"
15
- require "cl_options"
16
-
17
- # Foreign modules
18
- require "irb"
19
- require "rake"
20
-
21
- puts "\nEnter <thelp> for help on the Talia-specific commands."
22
- puts ""
23
-
24
- flags = TaliaCommands::flags
25
-
26
- unless(flags.noinit?)
27
- Util::init_talia
28
- Util::talia_config if(flags.verbose?)
29
- else
30
- puts "Talia not initialized, as requested."
31
- end
32
-
33
- IRB.start
34
-
35
- # if __FILE__ == $0
36
- # IRB.start(__FILE__)
37
- # else
38
- # # check -e option
39
- # if /^-e$/ =~ $0
40
- # IRB.start(__FILE__)
41
- # else
42
- # IRB.setup(__FILE__)
43
- # end
44
- # end
45
- end
46
-
47
- end
@@ -1,11 +0,0 @@
1
- #
2
- # Loads the commands that are defined for the talia core
3
- #
4
-
5
- command_dir = File.expand_path(File.join(File.dirname(__FILE__), 'commands'))
6
-
7
- $: << command_dir
8
-
9
- Dir["#{command_dir}/*.rb"].each do |file|
10
- require File.basename(file.gsub(/\.rb$/, ''))
11
- end
data/lib/talia_cl.rb DELETED
@@ -1,47 +0,0 @@
1
- # This is the loader file for the Talia command line tool.
2
- #
3
- # The Talia command line works as follows: This file will load some helper
4
- # methods that can be used to register subcommands for the command line tool.
5
- #
6
- # Each subcommand is registered with a name (as symbol), a description string
7
- # and a block that will be run if the command is selected.
8
- #
9
- # If the command line processing is started, the first command line argument
10
- # will be taken as the name of the command to be run. The argument will be
11
- # removed from ARGV, and then the block belonging to the command will be
12
- # executed.
13
- $: << File.join(File.expand_path(File.dirname(__FILE__)), "talia_cl")
14
-
15
- # require basic stuff
16
- require "talia_core"
17
- require "talia_util"
18
-
19
- include TaliaUtil
20
-
21
- require 'command_line'
22
- require 'core_commands'
23
-
24
- # Quick and dirty: Try to load the (Rails) add-on commands. If not found, ignore.
25
- begin
26
- require 'addon_commands'
27
- puts "Additional talia commands loaded"
28
- rescue LoadError
29
- puts "No additional talia commands found or loaded."
30
- end
31
-
32
-
33
- # Runs the command line
34
- def run_command_line
35
- Util::title
36
-
37
- command = ARGV.shift
38
-
39
- if(TaliaCommandLine::command?(command))
40
- TaliaCommandLine::run_command(command)
41
- else
42
- puts "Use talia <command> - possible commands:"
43
- TaliaCommandLine::each do |command, description|
44
- puts "#{command}\t- #{description}"
45
- end
46
- end
47
- end
data/lib/user.rb DELETED
@@ -1,116 +0,0 @@
1
- require 'digest/sha1'
2
- class User < ActiveRecord::Base
3
- include ActsAsRoled
4
- has_and_belongs_to_many :roles
5
- attr_accessor :roles_attributes
6
- attr_accessible :roles_attributes
7
- after_update :save_roles
8
-
9
- # authorized_as? simply needs to return true or false whether a user has a role or not.
10
- # It may be a good idea to have "admin" roles return true always
11
- def authorized_as?(role_name)
12
- return true if role_names.include?("admin")
13
- has_role?(role_name)
14
- end
15
-
16
- def has_role?(role_name)
17
- role_names.include? role_name.to_s
18
- end
19
-
20
- def roles_to_sentence
21
- role_names.to_sentence
22
- end
23
-
24
- # Virtual attribute for the unencrypted password
25
- attr_accessor :password
26
-
27
- validates_presence_of :login, :email
28
- validates_presence_of :password, :if => :password_required?
29
- validates_presence_of :password_confirmation, :if => :password_required?
30
- validates_length_of :password, :within => 4..40, :if => :password_required?
31
- validates_confirmation_of :password, :if => :password_required?
32
- validates_length_of :login, :within => 3..40
33
- validates_length_of :email, :within => 3..100
34
- validates_uniqueness_of :login, :email, :case_sensitive => false
35
- before_save :encrypt_password, :normalize_open_id
36
-
37
- # prevents a user from submitting a crafted form that bypasses activation
38
- # anything else you want your user to change should be added here.
39
- attr_accessible :login, :email, :password, :password_confirmation, :open_id
40
-
41
- # Authenticates a user by their login name and unencrypted password. Returns the user or nil.
42
- def self.authenticate(login, password)
43
- u = find_by_login(login) # need to get the salt
44
- u && u.authenticated?(password) ? u : nil
45
- end
46
-
47
- # Authenticates a user by their open id indentifier. Returns the user or nil.
48
- def self.open_id_authentication(identity_url)
49
- u = find_by_open_id(identity_url) # need to get the salt
50
- u ? u : nil
51
- end
52
-
53
- # Encrypts some data with the salt.
54
- def self.encrypt(password, salt)
55
- Digest::SHA1.hexdigest("--#{salt}--#{password}--")
56
- end
57
-
58
- # Encrypts the password with the user salt
59
- def encrypt(password)
60
- self.class.encrypt(password, salt)
61
- end
62
-
63
- def authenticated?(password)
64
- crypted_password == encrypt(password)
65
- end
66
-
67
- def remember_token?
68
- remember_token_expires_at && Time.now.utc < remember_token_expires_at
69
- end
70
-
71
- # These create and unset the fields required for remembering users between browser closes
72
- def remember_me
73
- remember_me_for 2.weeks
74
- end
75
-
76
- def remember_me_for(time)
77
- remember_me_until time.from_now.utc
78
- end
79
-
80
- def remember_me_until(time)
81
- self.remember_token_expires_at = time
82
- self.remember_token = encrypt("#{email}--#{remember_token_expires_at}")
83
- save(false)
84
- end
85
-
86
- def forget_me
87
- self.remember_token_expires_at = nil
88
- self.remember_token = nil
89
- save(false)
90
- end
91
-
92
- protected
93
- # before filter
94
- def encrypt_password
95
- return if password.blank?
96
- self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?
97
- self.crypted_password = encrypt(password)
98
- end
99
-
100
- def normalize_open_id
101
- self.open_id = OpenIdAuthentication.normalize_url(open_id) unless open_id.blank?
102
- end
103
-
104
- def password_required?
105
- crypted_password.blank? || !password.blank?
106
- end
107
-
108
- def role_names
109
- @role_names ||= self.roles.map(&:name)
110
- end
111
-
112
- def save_roles
113
- return if roles_attributes.nil?
114
- self.roles = Role.find_by_names(roles_attributes)
115
- end
116
- end