@@ -37,12 +37,12 class GroupBuiltin < Group | |||
|
37 | 37 | class << self |
|
38 | 38 | def load_instance |
|
39 | 39 | return nil if self == GroupBuiltin |
|
40 | instance = order('id').first || create_instance | |
|
40 | instance = unscoped.order('id').first || create_instance | |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | def create_instance |
|
44 | 44 | raise 'The builtin group already exists.' if exists? |
|
45 | instance = new | |
|
45 | instance = unscoped.new | |
|
46 | 46 | instance.lastname = name |
|
47 | 47 | instance.save :validate => false |
|
48 | 48 | raise 'Unable to create builtin group.' if instance.new_record? |
@@ -279,9 +279,9 private | |||
|
279 | 279 | end |
|
280 | 280 | |
|
281 | 281 | def self.find_or_create_system_role(builtin, name) |
|
282 | role = where(:builtin => builtin).first | |
|
282 | role = unscoped.where(:builtin => builtin).first | |
|
283 | 283 | if role.nil? |
|
284 | role = create(:name => name) do |r| | |
|
284 | role = unscoped.create(:name => name) do |r| | |
|
285 | 285 | r.builtin = builtin |
|
286 | 286 | end |
|
287 | 287 | raise "Unable to create the #{name} role (#{role.errors.full_messages.join(',')})." if role.new_record? |
@@ -745,9 +745,9 class User < Principal | |||
|
745 | 745 | # Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only |
|
746 | 746 | # one anonymous user per database. |
|
747 | 747 | def self.anonymous |
|
748 | anonymous_user = AnonymousUser.first | |
|
748 | anonymous_user = AnonymousUser.unscoped.first | |
|
749 | 749 | if anonymous_user.nil? |
|
750 | anonymous_user = AnonymousUser.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) | |
|
750 | anonymous_user = AnonymousUser.unscoped.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) | |
|
751 | 751 | raise 'Unable to create the anonymous user.' if anonymous_user.new_record? |
|
752 | 752 | end |
|
753 | 753 | anonymous_user |
General Comments 0
You need to be logged in to leave comments.
Login now