This commit is contained in:
parent
dd3ff7cde9
commit
405ee2efe6
@ -36,7 +36,7 @@ class DmsfFolderPermissionsController < ApplicationController
|
|||||||
|
|
||||||
def append
|
def append
|
||||||
@principals = Principal.where(id: params[:user_ids]).to_a
|
@principals = Principal.where(id: params[:user_ids]).to_a
|
||||||
head :success if @principals.blank?
|
head :ok if @principals.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def autocomplete_for_user
|
def autocomplete_for_user
|
||||||
|
|||||||
@ -23,6 +23,6 @@
|
|||||||
|
|
||||||
<span id="public_url" class="hol">
|
<span id="public_url" class="hol">
|
||||||
<%= check_box_tag('email[public_urls]', 1, false) %> <%= l(:label_public_urls) %>
|
<%= check_box_tag('email[public_urls]', 1, false) %> <%= l(:label_public_urls) %>
|
||||||
<%= date_field_tag('email[expired_at]', '', :value => (DateTime.now + 3.days).to_date, :size => 10,
|
<%= date_field_tag('email[expired_at]', '', :value => (DateTime.current + 3.days).to_date, :size => 10,
|
||||||
:readonly => true) + calendar_for('email_expired_at') %>
|
:readonly => true) + calendar_for('email_expired_at') %>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@ -25,11 +25,11 @@
|
|||||||
<% folders = DmsfFolder.visible.joins(
|
<% folders = DmsfFolder.visible.joins(
|
||||||
'JOIN dmsf_locks ON dmsf_folders.id = dmsf_locks.entity_id').where(
|
'JOIN dmsf_locks ON dmsf_folders.id = dmsf_locks.entity_id').where(
|
||||||
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
|
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
|
||||||
1, @user.id, Time.now]).all if @user %>
|
1, @user.id, Time.current]).all if @user %>
|
||||||
<% files = DmsfFile.visible.joins(
|
<% files = DmsfFile.visible.joins(
|
||||||
'JOIN dmsf_locks ON dmsf_files.id = dmsf_locks.entity_id').where(
|
'JOIN dmsf_locks ON dmsf_files.id = dmsf_locks.entity_id').where(
|
||||||
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
|
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
|
||||||
0, @user.id, Time.now]).all if @user %>
|
0, @user.id, Time.current]).all if @user %>
|
||||||
<% unless defined?(EasyExtensions) %>
|
<% unless defined?(EasyExtensions) %>
|
||||||
<h3><%= l(:locked_documents)%> (<%= folders.count %>/<%= files.count %>)</h3>
|
<h3><%= l(:locked_documents)%> (<%= folders.count %>/<%= files.count %>)</h3>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class DmsfFileContainer < ActiveRecord::Migration
|
|||||||
remove_index :dmsf_files, [:container_id, :container_type]
|
remove_index :dmsf_files, [:container_id, :container_type]
|
||||||
remove_column :dmsf_files, :container_type
|
remove_column :dmsf_files, :container_type
|
||||||
rename_column :dmsf_files, :container_id, :project_id
|
rename_column :dmsf_files, :container_id, :project_id
|
||||||
add_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id
|
remove_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -106,7 +106,7 @@ module DAV4Rack
|
|||||||
end
|
end
|
||||||
|
|
||||||
def remaining_timeout
|
def remaining_timeout
|
||||||
t = timeout.to_i - (Time.now.to_i - created_at.to_i)
|
t = timeout.to_i - (Time.current.to_i - created_at.to_i)
|
||||||
t < 0 ? 0 : t
|
t < 0 ? 0 : t
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ module DAV4Rack
|
|||||||
:token => token,
|
:token => token,
|
||||||
:timeout => timeout,
|
:timeout => timeout,
|
||||||
:depth => depth,
|
:depth => depth,
|
||||||
:created_at => Time.now,
|
:created_at => Time.current,
|
||||||
:owner => owner
|
:owner => owner
|
||||||
}
|
}
|
||||||
@store.transaction do
|
@store.transaction do
|
||||||
|
|||||||
@ -24,11 +24,11 @@ module DAV4Rack
|
|||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
start = Time.now
|
start = Time.current
|
||||||
request = setup_request env
|
request = setup_request env
|
||||||
response = Rack::Response.new
|
response = Rack::Response.new
|
||||||
|
|
||||||
Logger.info "Processing WebDAV request: #{request.path} (for #{request.ip} at #{Time.now}) [#{request.request_method}]"
|
Logger.info "Processing WebDAV request: #{request.path} (for #{request.ip} at #{Time.current}) [#{request.request_method}]"
|
||||||
|
|
||||||
controller = setup_controller request, response
|
controller = setup_controller request, response
|
||||||
controller.process
|
controller.process
|
||||||
@ -41,7 +41,7 @@ module DAV4Rack
|
|||||||
if Logger.debug? and response.body.is_a?(String)
|
if Logger.debug? and response.body.is_a?(String)
|
||||||
Logger.debug "Response String:\n#{response.body}"
|
Logger.debug "Response String:\n#{response.body}"
|
||||||
end
|
end
|
||||||
Logger.info "Completed in: #{((Time.now.to_f - start.to_f) * 1000).to_i} ms | #{response.status} [#{request.url}]"
|
Logger.info "Completed in: #{((Time.current.to_f - start.to_f) * 1000).to_i} ms | #{response.status} [#{request.url}]"
|
||||||
|
|
||||||
response.finish
|
response.finish
|
||||||
|
|
||||||
|
|||||||
@ -25,15 +25,15 @@ module DAV4Rack
|
|||||||
end
|
end
|
||||||
|
|
||||||
def creation_date
|
def creation_date
|
||||||
Time.now
|
Time.current
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_modified
|
def last_modified
|
||||||
Time.now
|
Time.current
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_modified=(time)
|
def last_modified=(time)
|
||||||
Time.now
|
Time.current
|
||||||
end
|
end
|
||||||
|
|
||||||
def etag
|
def etag
|
||||||
|
|||||||
@ -4,8 +4,8 @@ module DAV4Rack
|
|||||||
def initialize(args={})
|
def initialize(args={})
|
||||||
@args = args
|
@args = args
|
||||||
@store = nil
|
@store = nil
|
||||||
@args[:created_at] = Time.now
|
@args[:created_at] = Time.current
|
||||||
@args[:updated_at] = Time.now
|
@args[:updated_at] = Time.current
|
||||||
end
|
end
|
||||||
|
|
||||||
def store
|
def store
|
||||||
@ -24,7 +24,7 @@ module DAV4Rack
|
|||||||
end
|
end
|
||||||
|
|
||||||
def remaining_timeout
|
def remaining_timeout
|
||||||
@args[:timeout].to_i - (Time.now.to_i - @args[:created_at].to_i)
|
@args[:timeout].to_i - (Time.current.to_i - @args[:created_at].to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(*args)
|
def method_missing(*args)
|
||||||
|
|||||||
@ -107,7 +107,7 @@ module DAV4Rack
|
|||||||
|
|
||||||
# Last modified type based on provided, remote headers or current time
|
# Last modified type based on provided, remote headers or current time
|
||||||
def last_modified
|
def last_modified
|
||||||
@heads['last-modified'] || @modified || Time.now.httpdate
|
@heads['last-modified'] || @modified || Time.current.httpdate
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds the path for the cached file
|
# Builds the path for the cached file
|
||||||
|
|||||||
@ -42,7 +42,7 @@ module DAV4Rack
|
|||||||
|
|
||||||
# Set the time of last modification.
|
# Set the time of last modification.
|
||||||
def last_modified=(time)
|
def last_modified=(time)
|
||||||
::File.utime(Time.now, time, file_path)
|
::File.utime(Time.current, time, file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return an Etag, an unique hash value for this resource.
|
# Return an Etag, an unique hash value for this resource.
|
||||||
|
|||||||
36
test/fixtures/dmsf_links.yml
vendored
36
test/fixtures/dmsf_links.yml
vendored
@ -6,11 +6,11 @@ folder_link:
|
|||||||
target_type: DmsfFolder
|
target_type: DmsfFolder
|
||||||
name: folder1_link
|
name: folder1_link
|
||||||
project_id: 1
|
project_id: 1
|
||||||
dmsf_folder_id: NULL
|
dmsf_folder_id: nil
|
||||||
deleted: 0
|
deleted: 0
|
||||||
deleted_by_user_id: NULL
|
deleted_by_user_id: nil
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
|
|
||||||
file_link:
|
file_link:
|
||||||
id: 2
|
id: 2
|
||||||
@ -21,9 +21,9 @@ file_link:
|
|||||||
project_id: 1
|
project_id: 1
|
||||||
dmsf_folder_id: 1
|
dmsf_folder_id: 1
|
||||||
deleted: 0
|
deleted: 0
|
||||||
deleted_by_user_id: NULL
|
deleted_by_user_id: nil
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
|
|
||||||
folder_link2:
|
folder_link2:
|
||||||
id: 3
|
id: 3
|
||||||
@ -32,11 +32,11 @@ folder_link2:
|
|||||||
target_type: DmsfFolder
|
target_type: DmsfFolder
|
||||||
name: folder4_link
|
name: folder4_link
|
||||||
project_id: 2
|
project_id: 2
|
||||||
dmsf_folder_id: NULL
|
dmsf_folder_id: nil
|
||||||
deleted: 0
|
deleted: 0
|
||||||
deleted_by_user_id: NULL
|
deleted_by_user_id: nil
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
|
|
||||||
file_link2:
|
file_link2:
|
||||||
id: 4
|
id: 4
|
||||||
@ -45,11 +45,11 @@ file_link2:
|
|||||||
target_type: DmsfFile
|
target_type: DmsfFile
|
||||||
name: test_link
|
name: test_link
|
||||||
project_id: 1
|
project_id: 1
|
||||||
dmsf_folder_id: NULL
|
dmsf_folder_id: nil
|
||||||
deleted: 0
|
deleted: 0
|
||||||
deleted_by_user_id: NULL
|
deleted_by_user_id: nil
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
|
|
||||||
url_link:
|
url_link:
|
||||||
id: 5
|
id: 5
|
||||||
@ -60,6 +60,6 @@ url_link:
|
|||||||
project_id: 1
|
project_id: 1
|
||||||
external_url: 'https://www.kontron.com'
|
external_url: 'https://www.kontron.com'
|
||||||
deleted: 0
|
deleted: 0
|
||||||
deleted_by_user_id: NULL
|
deleted_by_user_id: nil
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
12
test/fixtures/dmsf_public_urls.yml
vendored
12
test/fixtures/dmsf_public_urls.yml
vendored
@ -4,15 +4,15 @@ public_url_1:
|
|||||||
dmsf_file_id: 1
|
dmsf_file_id: 1
|
||||||
user_id: 1
|
user_id: 1
|
||||||
token: 'd8d33e21914a433b280fdc94450ee212'
|
token: 'd8d33e21914a433b280fdc94450ee212'
|
||||||
expire_at: <%= (Time.now + 1.day).to_date %>
|
expire_at: <%= (Time.current + 1.day).to_date %>
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
|
|
||||||
public_url_2:
|
public_url_2:
|
||||||
id: 2
|
id: 2
|
||||||
dmsf_file_id: 1
|
dmsf_file_id: 1
|
||||||
user_id: 1
|
user_id: 1
|
||||||
token: 'e8d33e21914a433b280fdc94450ee212'
|
token: 'e8d33e21914a433b280fdc94450ee212'
|
||||||
expire_at: <%= (Time.now - 1.day).to_date %>
|
expire_at: <%= (Time.current - 1.day).to_date %>
|
||||||
created_at: <%= DateTime.now() %>
|
created_at: <%= DateTime.current %>
|
||||||
updated_at: <%= DateTime.now() %>
|
updated_at: <%= DateTime.current %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user