last_name: 'anonymouspublic')
$anonymous_user.save!
$anonymous_user.reload
+ end
- group_perms = Link.where(tail_uuid: anonymous_user_uuid,
- head_uuid: anonymous_group_uuid,
- link_class: 'permission',
- name: 'can_read')
+ group_perms = Link.where(tail_uuid: anonymous_user_uuid,
+ head_uuid: anonymous_group_uuid,
+ link_class: 'permission',
+ name: 'can_read')
- if !group_perms.any?
- group_perm = Link.create(tail_uuid: anonymous_user_uuid,
- head_uuid: anonymous_group_uuid,
- link_class: 'permission',
- name: 'can_read')
- end
+ if !group_perms.any?
+ group_perm = Link.create!(tail_uuid: anonymous_user_uuid,
+ head_uuid: anonymous_group_uuid,
+ link_class: 'permission',
+ name: 'can_read')
end
end
end
api_client_auth = ApiClientAuthorization.
new(user: anonymous_user,
api_client_id: 0,
+ expires_at: Time.now + 100.years,
scopes: ['GET /'])
api_client_auth.save!
api_client_auth.reload
if get_existing
api_client_auth = ApiClientAuthorization.
- where('user_id=?', anonymous_user.id.to_i).first
+ where('user_id=?', anonymous_user.id.to_i).
+ where('expires_at>?', Time.now).
+ select { |auth| auth.scopes == ['GET /'] }.
+ first
end
# either not a get or no api_client_auth was found