cmis_server 1.0.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +14 -0
- data/app/controllers/cmis_server/atom_pub/base_controller.rb +43 -0
- data/app/controllers/cmis_server/atom_pub/bulk_controller.rb +2 -0
- data/app/controllers/cmis_server/atom_pub/content_controller.rb +2 -0
- data/app/controllers/cmis_server/atom_pub/entries_controller.rb +2 -0
- data/app/controllers/cmis_server/atom_pub/folder_collection_controller.rb +8 -0
- data/app/controllers/cmis_server/atom_pub/query_controller.rb +8 -2
- data/app/controllers/cmis_server/atom_pub/repository_controller.rb +5 -1
- data/app/controllers/cmis_server/atom_pub/secondary_types_controller.rb +2 -0
- data/app/controllers/cmis_server/atom_pub/service_documents_controller.rb +4 -1
- data/app/controllers/cmis_server/atom_pub/types_controller.rb +2 -0
- data/app/controllers/cmis_server/atom_pub/uri_templates_controller.rb +32 -21
- data/app/services/cmis_server/object_service.rb +21 -11
- data/app/services/cmis_server/repository_service.rb +10 -8
- data/app/views/cmis_server/atom_pub/entries/_cmis_folder_links.atom_entry.builder +1 -1
- data/app/views/cmis_server/atom_pub/entries/_object_entry.atom_entry.builder +3 -3
- data/app/views/cmis_server/atom_pub/entries/type_entry.atom_entry.builder +1 -1
- data/app/views/cmis_server/atom_pub/feeds/feed.atom_feed.builder +1 -1
- data/app/views/cmis_server/atom_pub/service_documents/_workspace.atom_service.builder +6 -26
- data/config/initializers/cmis_base_types.rb +95 -0
- data/config/initializers/cmis_core_configuration.rb +60 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/routes.rb +37 -28
- data/config/routes_standard.rb +49 -0
- data/lib/cmis_server/base_objects/base_type.rb +14 -1
- data/lib/cmis_server/base_objects/folder.rb +1 -1
- data/lib/cmis_server/base_types.rb +11 -1
- data/lib/cmis_server/configuration.rb +12 -3
- data/lib/cmis_server/connectors/base_connector.rb +41 -0
- data/lib/cmis_server/connectors/connector_factory.rb +20 -0
- data/lib/cmis_server/connectors/core_connector.rb +300 -0
- data/lib/cmis_server/context.rb +10 -0
- data/lib/cmis_server/engine.rb +13 -54
- data/lib/cmis_server/engine_diagnostics.rb +56 -0
- data/lib/cmis_server/folder_object.rb +12 -1
- data/lib/cmis_server/inflections.rb +13 -0
- data/lib/cmis_server/repository.rb +116 -5
- data/lib/cmis_server/type.rb +1 -1
- data/lib/cmis_server/version.rb +1 -1
- data/lib/cmis_server/zeitwerk_configuration.rb +39 -0
- data/lib/cmis_server.rb +264 -1
- data/test/dummy/log/test.log +0 -0
- metadata +47 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd8e8b28a3d38e71270a181bd6817bb486492911bc2411344e88e6b70b9b4dd
|
4
|
+
data.tar.gz: a509fefe60180d876c152132e1aa7ea93a03d8261cb05b8a1d0c2d7cb1a8f873
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5b50cf64970bb7f3777f56b05a76f6593637db0d1ce66cdc75aea61a786b910471e955183fd710196cf3d59c7786514170b772a28550da84d6bb67ac9bff201
|
7
|
+
data.tar.gz: 4f6ba22462abe9188d2c875ff4882c4e45be22d390c3de386e3ddd15eb85b259b520cb7907ab7d14c07d17bce490201002bfb2ba5335c039b33ae7a5f9026676
|
data/Rakefile
CHANGED
@@ -33,6 +33,20 @@ Rake::TestTask.new(:test) do |t|
|
|
33
33
|
t.verbose = false
|
34
34
|
end
|
35
35
|
|
36
|
+
# Ajouter RSpec pour les nouveaux tests
|
37
|
+
begin
|
38
|
+
require 'rspec/core/rake_task'
|
39
|
+
|
40
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
41
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:parser, :spec, :test]
|
45
|
+
rescue LoadError
|
46
|
+
# RSpec n'est pas disponible
|
47
|
+
task :default => [:parser, :test]
|
48
|
+
end
|
49
|
+
|
36
50
|
|
37
51
|
GENERATED_PARSER = 'lib/cmis_server/query/parser.racc.rb'
|
38
52
|
GENERATED_LEXER = 'lib/cmis_server/query/parser.rex.rb'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../application_controller'
|
2
|
+
|
1
3
|
module CmisServer
|
2
4
|
module AtomPub
|
3
5
|
class BaseController < CmisServer::ApplicationController
|
@@ -18,6 +20,47 @@ module CmisServer
|
|
18
20
|
|
19
21
|
render xml: cmis_error.to_xml, content_type: 'application/xml', status: cmis_error.http_status_code
|
20
22
|
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def repository_from_request
|
27
|
+
@repository ||= CmisServer::Repository.find(params[:repository_id] || 'default')
|
28
|
+
end
|
29
|
+
|
30
|
+
def current_repository
|
31
|
+
repository_from_request
|
32
|
+
end
|
33
|
+
|
34
|
+
def render_error(error)
|
35
|
+
render_standard_error(error)
|
36
|
+
end
|
37
|
+
|
38
|
+
def current_context
|
39
|
+
@current_context ||= CmisServer::Context.new(
|
40
|
+
current_user: current_user
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def current_user
|
45
|
+
# Récupérer l'utilisateur depuis l'authentification HTTP Basic
|
46
|
+
# L'authentification retourne déjà l'objet utilisateur approprié
|
47
|
+
request.env['HTTP_AUTHORIZATION'] ? authenticated_user_from_auth : nil
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def authenticated_user_from_auth
|
53
|
+
# Extraire les credentials de l'en-tête Authorization
|
54
|
+
auth_header = request.env['HTTP_AUTHORIZATION']
|
55
|
+
return nil unless auth_header&.start_with?('Basic ')
|
56
|
+
|
57
|
+
encoded_credentials = auth_header.split(' ', 2).last
|
58
|
+
decoded_credentials = Base64.decode64(encoded_credentials)
|
59
|
+
username, password = decoded_credentials.split(':', 2)
|
60
|
+
|
61
|
+
# Appeler la procédure d'authentification configurée
|
62
|
+
CmisServer.configuration.http_basic_auth_procedure.call(username, password)
|
63
|
+
end
|
21
64
|
end
|
22
65
|
end
|
23
66
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'base_controller'
|
2
|
+
|
1
3
|
module CmisServer
|
2
4
|
module AtomPub
|
3
5
|
class FolderCollectionController < CmisServer::AtomPub::BaseController
|
@@ -54,6 +56,12 @@ module CmisServer
|
|
54
56
|
service=NavigationService.new(@repository, context)
|
55
57
|
service.get_descendants(params[:id])
|
56
58
|
end
|
59
|
+
|
60
|
+
def destroy
|
61
|
+
service = ObjectService.new(@repository, context)
|
62
|
+
service.delete_object(params[:id])
|
63
|
+
head :no_content
|
64
|
+
end
|
57
65
|
|
58
66
|
protected
|
59
67
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'base_controller'
|
2
|
+
|
1
3
|
module CmisServer
|
2
4
|
module AtomPub
|
3
5
|
class QueryController < BaseController
|
@@ -10,7 +12,7 @@ module CmisServer
|
|
10
12
|
query_data = parse_query_request
|
11
13
|
|
12
14
|
begin
|
13
|
-
discovery_service = CmisServer::DiscoveryService.new(
|
15
|
+
discovery_service = CmisServer::DiscoveryService.new(@repository, current_context)
|
14
16
|
results = discovery_service.query(
|
15
17
|
statement: query_data[:statement],
|
16
18
|
search_all_versions: query_data[:search_all_versions],
|
@@ -46,7 +48,7 @@ module CmisServer
|
|
46
48
|
query_data = parse_query_request
|
47
49
|
|
48
50
|
begin
|
49
|
-
discovery_service = CmisServer::DiscoveryService.new(
|
51
|
+
discovery_service = CmisServer::DiscoveryService.new(@repository, current_context)
|
50
52
|
validation_result = discovery_service.validate_query(query_data[:statement])
|
51
53
|
|
52
54
|
respond_to do |format|
|
@@ -83,6 +85,10 @@ module CmisServer
|
|
83
85
|
parse_atom_pub_query_request
|
84
86
|
end
|
85
87
|
end
|
88
|
+
|
89
|
+
def supports_browser_binding?
|
90
|
+
request.content_type&.include?('application/json')
|
91
|
+
end
|
86
92
|
|
87
93
|
def parse_browser_binding_query_request
|
88
94
|
json_data = JSON.parse(request.body.read)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'base_controller'
|
2
|
+
|
1
3
|
module CmisServer
|
2
4
|
module AtomPub
|
3
5
|
class RepositoryController < BaseController
|
@@ -56,7 +58,9 @@ module CmisServer
|
|
56
58
|
private
|
57
59
|
|
58
60
|
def enhance_capabilities_for_cmis_1_1(capabilities)
|
59
|
-
capabilities.
|
61
|
+
capabilities_hash = capabilities.respond_to?(:to_h) ? capabilities.to_h : capabilities
|
62
|
+
|
63
|
+
capabilities_hash.merge({
|
60
64
|
# Nouvelles capabilities CMIS 1.1
|
61
65
|
type_management: capabilities[:create_type] || false,
|
62
66
|
bulk_update: capabilities[:bulk_update] || false,
|
@@ -1,7 +1,10 @@
|
|
1
|
+
require_relative 'base_controller'
|
2
|
+
|
1
3
|
module CmisServer
|
2
4
|
module AtomPub
|
3
5
|
class ServiceDocumentsController < CmisServer::AtomPub::BaseController
|
4
|
-
require 'atom/service'
|
6
|
+
# Supprimé la dépendance "require 'atom/service'" qui cause des problèmes
|
7
|
+
# Si nécessaire, vous pouvez ajouter d'autres bibliothèques ici
|
5
8
|
|
6
9
|
|
7
10
|
def service_document
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'base_controller'
|
2
|
+
|
1
3
|
module CmisServer
|
2
4
|
module AtomPub
|
3
5
|
class UriTemplatesController < CmisServer::AtomPub::BaseController
|
@@ -8,40 +10,49 @@ module CmisServer
|
|
8
10
|
|
9
11
|
|
10
12
|
def object_by_id
|
11
|
-
service=ObjectService.new(@repository,
|
12
|
-
@object=service.get_object(params[:id], with_object: true, filter: @filter)
|
13
|
+
service = CmisServer::ObjectService.new(@repository, current_context)
|
14
|
+
@object = service.get_object(params[:id], with_object: true, filter: @filter)
|
13
15
|
render 'cmis_server/atom_pub/entries/object_entry', formats: :atom_entry
|
14
16
|
end
|
15
17
|
|
16
18
|
def object_by_path
|
17
|
-
service=ObjectService.new(@repository,
|
18
|
-
@object=service.get_object_by_path(params[:path], with_object: true, filter: @filter)
|
19
|
+
service = CmisServer::ObjectService.new(@repository, current_context)
|
20
|
+
@object = service.get_object_by_path(params[:path], with_object: true, filter: @filter)
|
19
21
|
render 'cmis_server/atom_pub/entries/object_entry', formats: :atom_entry
|
20
22
|
end
|
21
23
|
|
22
24
|
def type_by_id
|
23
|
-
service=RepositoryService.new(@repository)
|
24
|
-
@type
|
25
|
-
|
26
|
-
|
27
|
-
return render 'cmis_server/atom_pub/entries/type_entry', formats: :atom_entry
|
25
|
+
service = CmisServer::RepositoryService.new(@repository)
|
26
|
+
@type = service.get_type_definition(params[:id])
|
27
|
+
render 'cmis_server/atom_pub/entries/type_entry', formats: :atom_entry
|
28
28
|
end
|
29
29
|
|
30
30
|
def query
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
if request.post?
|
32
|
+
# POST query with XML/JSON body
|
33
|
+
if request.content_type =~ /xml/
|
34
|
+
query_params = Hash.from_xml(raw_post_body)["query"].slice("statement", "searchAllVersions", "includeAllowableActions", "includeRelationships", "renditionFilter", "maxItems", "skipCount")
|
35
|
+
else
|
36
|
+
# JSON body
|
37
|
+
query_params = JSON.parse(raw_post_body)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
# GET query with URL parameters
|
41
|
+
query_params = params.slice(:statement, :searchAllVersions, :includeAllowableActions, :includeRelationships, :renditionFilter, :maxItems, :skipCount)
|
42
|
+
end
|
43
|
+
|
44
|
+
service = CmisServer::DiscoveryService.new(@repository, current_context)
|
45
|
+
response = service.query(query_params['statement'] || query_params[:statement],
|
46
|
+
search_all_versions: (query_params['searchAllVersions'] == 'true' || query_params[:searchAllVersions] == 'true'),
|
47
|
+
rendition_filter: (query_params['renditionFilter'] || query_params[:renditionFilter] || 'cmis:none'),
|
48
|
+
include_relationships: ((query_params['includeRelationships'] || query_params[:includeRelationships])&.to_sym || :none),
|
49
|
+
include_allowable_actions: (query_params['includeAllowableActions'] == 'true' || query_params[:includeAllowableActions] == 'true'),
|
50
|
+
max_items: ((query_params['maxItems'] || query_params[:maxItems]) || 10).to_i,
|
51
|
+
skip_count: ((query_params['skipCount'] || query_params[:skipCount]) || 0).to_i
|
41
52
|
)
|
42
53
|
|
43
|
-
@collection=RenderableCollection.new(base_object:
|
44
|
-
items:
|
54
|
+
@collection = CmisServer::RenderableCollection.new(base_object: nil,
|
55
|
+
items: response[:query_results],
|
45
56
|
atompub_properties: {title: "Query"})
|
46
57
|
render 'cmis_server/atom_pub/feeds/feed', formats: :atom_feed, status: :created
|
47
58
|
end
|
@@ -64,11 +64,17 @@ module CmisServer
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def get_object(id, filter: [], include_relationships: :none, include_policy_ids: false, rendition_filter: "cmis:none", include_acl: false, include_allowable_actions: false, with_object: false)
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
# Utiliser le nouveau connecteur pour récupérer l'objet
|
68
|
+
connector = CmisServer::Connectors::ConnectorFactory.create_connector(
|
69
|
+
user: @context[:current_user] || @context.current_user
|
70
|
+
)
|
71
|
+
|
72
|
+
record = connector.find_object_by_id(id)
|
70
73
|
raise CmisServer::ObjectNotFound unless record
|
71
|
-
|
74
|
+
|
75
|
+
# Pour l'instant, retourner l'objet tel quel
|
76
|
+
# TODO: implémenter la conversion en renderable_object
|
77
|
+
record
|
72
78
|
end
|
73
79
|
|
74
80
|
def get_properties(id, filter: [])
|
@@ -76,13 +82,17 @@ module CmisServer
|
|
76
82
|
end
|
77
83
|
|
78
84
|
def get_object_by_path(path, filter: [], include_relationships: :none, include_policy_ids: false, rendition_filter: "cmis:none", include_acl: false, include_allowable_actions: false, with_object: false)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
# Utiliser le nouveau connecteur pour récupérer l'objet par path
|
86
|
+
connector = CmisServer::Connectors::ConnectorFactory.create_connector(
|
87
|
+
user: @context[:current_user] || @context.current_user
|
88
|
+
)
|
89
|
+
|
90
|
+
record = connector.find_object_by_path(path)
|
91
|
+
raise CmisServer::ObjectNotFound unless record
|
92
|
+
|
93
|
+
# Pour l'instant, retourner l'objet tel quel
|
94
|
+
# TODO: implémenter la conversion en renderable_object
|
95
|
+
record
|
86
96
|
end
|
87
97
|
|
88
98
|
def get_content_stream
|
@@ -6,7 +6,7 @@ module CmisServer
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def get_repositories
|
9
|
-
raise
|
9
|
+
raise CmisServer::NotSupported.new("get_repositories not implemented")
|
10
10
|
end
|
11
11
|
|
12
12
|
def get_repository_info
|
@@ -14,27 +14,29 @@ module CmisServer
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get_type_children
|
17
|
-
raise
|
17
|
+
raise CmisServer::NotSupported.new("get_type_children not implemented")
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_type_descendants
|
21
|
-
raise
|
21
|
+
raise CmisServer::NotSupported.new("get_type_descendants not implemented")
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
type=CmisServer::
|
24
|
+
def get_type_definition(type_id)
|
25
|
+
type = CmisServer::TypeRegistry.get_type(type_id)
|
26
|
+
raise CmisServer::ObjectNotFound.new("Type '#{type_id}' not found") unless type
|
27
|
+
type
|
26
28
|
end
|
27
29
|
|
28
30
|
def create_type(type)
|
29
|
-
raise
|
31
|
+
raise CmisServer::NotSupported.new("create_type not implemented")
|
30
32
|
end
|
31
33
|
|
32
34
|
def update_type(type)
|
33
|
-
raise
|
35
|
+
raise CmisServer::NotSupported.new("update_type not implemented")
|
34
36
|
end
|
35
37
|
|
36
38
|
def delete_type(type)
|
37
|
-
raise
|
39
|
+
raise CmisServer::NotSupported.new("delete_type not implemented")
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -12,10 +12,10 @@ xml.tag!('entry', 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
|
12
12
|
end
|
13
13
|
|
14
14
|
if cs=object.atompub_entry_properties[:content]
|
15
|
-
xml.content type: cs.media_type.to_s, src:
|
15
|
+
xml.content type: cs.media_type.to_s, src: url_for(controller: 'cmis_server/atom_pub/content', action: 'show', id: cs.id, only_path: false)
|
16
16
|
end
|
17
|
-
xml.link(rel: 'service', href:
|
18
|
-
xml.link(rel: 'self', href:
|
17
|
+
xml.link(rel: 'service', href: url_for(controller: 'cmis_server/atom_pub/service_documents', action: 'service_document', only_path: false), type: 'application/atomsvc+xml')
|
18
|
+
xml.link(rel: 'self', href: url_for(controller: 'cmis_server/atom_pub/entries', action: 'show', id: object.base_object.cmis_object_id, only_path: false), type: 'application/atomsvc+xml')
|
19
19
|
xml<<links_for(object.base_object)
|
20
20
|
|
21
21
|
|
@@ -13,7 +13,7 @@ xml.tag!('entry', 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
|
13
13
|
end
|
14
14
|
|
15
15
|
xml.link(rel: 'service', href: atom_pub_url, type: 'application/atomsvc+xml')
|
16
|
-
xml.link(rel: 'self', href:
|
16
|
+
xml.link(rel: 'self', href: url_for(controller: 'cmis_server/atom_pub/uri_templates', action: 'type_by_id', id: @type.id, only_path: false), type: 'application/atomsvc+xml')
|
17
17
|
|
18
18
|
xml.tag!("app:edited", DateTime.now)
|
19
19
|
|
@@ -12,7 +12,7 @@ xml.tag!('atom:feed', 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
|
12
12
|
|
13
13
|
if @collection.base_object
|
14
14
|
xml << render(partial: 'cmis_server/atom_pub/shared/collection', formats: [:xml], locals: {
|
15
|
-
href:
|
15
|
+
href: url_for(controller: 'cmis_server/atom_pub/folder_collection', action: 'get_children', id: @collection.base_object.cmis_object_id, only_path: false),
|
16
16
|
title: "Folder Collection",
|
17
17
|
accept: "application/cmisatom+xml",
|
18
18
|
})
|
@@ -33,56 +33,36 @@ xml.tag!('app:workspace') do
|
|
33
33
|
|
34
34
|
xml << render(partial: 'cmis_server/atom_pub/shared/collection', formats: [:xml], locals: {
|
35
35
|
type: "root",
|
36
|
-
href:
|
36
|
+
href: url_for(controller: 'cmis_server/atom_pub/folder_collection', action: 'get_children', repository_id: repository.id, id: CmisServer::FolderObject.root_folder.cmis_object_id, only_path: false),
|
37
37
|
title: "Root Collection",
|
38
38
|
accept: "application/atom+xml;type=entry",
|
39
39
|
})
|
40
40
|
|
41
41
|
xml << render(partial: 'cmis_server/atom_pub/shared/collection', formats: [:xml], locals: {
|
42
42
|
type: "query",
|
43
|
-
href:
|
43
|
+
href: url_for(controller: 'cmis_server/atom_pub/query', action: 'query', repository_id: repository.id, only_path: false),
|
44
44
|
title: "Query Collection",
|
45
45
|
accept: "application/cmisquery+xml",
|
46
46
|
})
|
47
47
|
|
48
48
|
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
49
49
|
type: "objectbyid",
|
50
|
-
template:
|
51
|
-
filter: '{filter}',
|
52
|
-
include_allowable_actions: '{includeAllowableActions}',
|
53
|
-
include_acl: "{includeACL}",
|
54
|
-
include_policy_ids: "{includePolicyIds}",
|
55
|
-
include_relationships: "{includeRelationships}",
|
56
|
-
rendition_filter: "{renditionFilter}"
|
57
|
-
})),
|
50
|
+
template: request.base_url + "/cmis/atom_pub/#{repository.id}/id?id={id}&filter={filter}&includeAllowableActions={includeAllowableActions}&includeACL={includeACL}&includePolicyIds={includePolicyIds}&includeRelationships={includeRelationships}&renditionFilter={renditionFilter}",
|
58
51
|
mediatype: 'application/atom+xml;type=entry'
|
59
52
|
})
|
60
53
|
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
61
54
|
type: "objectbypath",
|
62
|
-
template:
|
63
|
-
filter: '{filter}',
|
64
|
-
include_allowable_actions: '{includeAllowableActions}',
|
65
|
-
include_acl: "{includeACL}",
|
66
|
-
include_policy_ids: "{includePolicyIds}",
|
67
|
-
include_relationships: "{includeRelationships}",
|
68
|
-
rendition_filter: "{renditionFilter}"
|
69
|
-
})),
|
55
|
+
template: request.base_url + "/cmis/atom_pub/#{repository.id}/path?path={path}&filter={filter}&includeAllowableActions={includeAllowableActions}&includeACL={includeACL}&includePolicyIds={includePolicyIds}&includeRelationships={includeRelationships}&renditionFilter={renditionFilter}",
|
70
56
|
mediatype: 'application/atom+xml;type=entry'
|
71
57
|
})
|
72
58
|
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
73
59
|
type: "typebyid",
|
74
|
-
template:
|
60
|
+
template: request.base_url + "/cmis/atom_pub/#{repository.id}/type?id={id}",
|
75
61
|
mediatype: 'application/atom+xml;type=entry'
|
76
62
|
})
|
77
63
|
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
78
64
|
type: "query",
|
79
|
-
template:
|
80
|
-
search_all_versions: '{searchAllVersions}',
|
81
|
-
include_allowable_actions: '{includeAllowableActions}',
|
82
|
-
include_relationships: "{includeRelationships}",
|
83
|
-
max_items: "{maxItems}",
|
84
|
-
skip_count: "{skipCount}",
|
85
|
-
})),
|
65
|
+
template: request.base_url + "/cmis/atom_pub/#{repository.id}/query?q={q}&searchAllVersions={searchAllVersions}&includeAllowableActions={includeAllowableActions}&includeRelationships={includeRelationships}&maxItems={maxItems}&skipCount={skipCount}",
|
86
66
|
mediatype: 'application/atom+xml;type=entry'
|
87
67
|
})
|
88
68
|
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Initialisation des types CMIS de base
|
2
|
+
# Ce fichier configure les types CMIS standards requis par la spécification
|
3
|
+
|
4
|
+
Rails.application.config.after_initialize do
|
5
|
+
# Enregistrer les types CMIS de base seulement s'ils n'existent pas déjà
|
6
|
+
unless CmisServer::TypeRegistry.get_type('cmis:document')
|
7
|
+
# Type de base Document
|
8
|
+
document_type = CmisServer::DocumentType.new(
|
9
|
+
id: 'cmis:document',
|
10
|
+
local_name: 'document',
|
11
|
+
display_name: 'Document',
|
12
|
+
query_name: 'cmis:document',
|
13
|
+
description: 'Base type for all documents',
|
14
|
+
base_id: 'cmis:document',
|
15
|
+
parent_type: nil,
|
16
|
+
creatable: true,
|
17
|
+
fileable: true,
|
18
|
+
queryable: true,
|
19
|
+
controllable_policy: false,
|
20
|
+
controllable_acl: true,
|
21
|
+
fulltext_indexed: false,
|
22
|
+
included_in_supertype_query: true,
|
23
|
+
property_definitions: []
|
24
|
+
)
|
25
|
+
CmisServer::TypeRegistry.register_type('cmis:document', document_type)
|
26
|
+
end
|
27
|
+
|
28
|
+
unless CmisServer::TypeRegistry.get_type('cmis:folder')
|
29
|
+
# Type de base Folder
|
30
|
+
folder_type = CmisServer::FolderType.new(
|
31
|
+
id: 'cmis:folder',
|
32
|
+
local_name: 'folder',
|
33
|
+
display_name: 'Folder',
|
34
|
+
query_name: 'cmis:folder',
|
35
|
+
description: 'Base type for all folders',
|
36
|
+
base_id: 'cmis:folder',
|
37
|
+
parent_type: nil,
|
38
|
+
creatable: true,
|
39
|
+
fileable: true,
|
40
|
+
queryable: true,
|
41
|
+
controllable_policy: false,
|
42
|
+
controllable_acl: true,
|
43
|
+
fulltext_indexed: false,
|
44
|
+
included_in_supertype_query: true,
|
45
|
+
property_definitions: []
|
46
|
+
)
|
47
|
+
CmisServer::TypeRegistry.register_type('cmis:folder', folder_type)
|
48
|
+
end
|
49
|
+
|
50
|
+
unless CmisServer::TypeRegistry.get_type('cmis:item')
|
51
|
+
# Type de base Item (CMIS 1.1)
|
52
|
+
item_type = CmisServer::ItemType.new(
|
53
|
+
id: 'cmis:item',
|
54
|
+
local_name: 'item',
|
55
|
+
display_name: 'Item',
|
56
|
+
query_name: 'cmis:item',
|
57
|
+
description: 'Base type for all items',
|
58
|
+
base_id: 'cmis:item',
|
59
|
+
parent_type: nil,
|
60
|
+
creatable: true,
|
61
|
+
fileable: true,
|
62
|
+
queryable: true,
|
63
|
+
controllable_policy: false,
|
64
|
+
controllable_acl: true,
|
65
|
+
fulltext_indexed: false,
|
66
|
+
included_in_supertype_query: true,
|
67
|
+
property_definitions: []
|
68
|
+
)
|
69
|
+
CmisServer::TypeRegistry.register_type('cmis:item', item_type)
|
70
|
+
end
|
71
|
+
|
72
|
+
unless CmisServer::TypeRegistry.get_type('cmis:secondary')
|
73
|
+
# Type de base Secondary (CMIS 1.1)
|
74
|
+
secondary_type = CmisServer::SecondaryType.new(
|
75
|
+
id: 'cmis:secondary',
|
76
|
+
local_name: 'secondary',
|
77
|
+
display_name: 'Secondary Type',
|
78
|
+
query_name: 'cmis:secondary',
|
79
|
+
description: 'Base type for all secondary types',
|
80
|
+
base_id: 'cmis:secondary',
|
81
|
+
parent_type: nil,
|
82
|
+
creatable: false,
|
83
|
+
fileable: false,
|
84
|
+
queryable: true,
|
85
|
+
controllable_policy: false,
|
86
|
+
controllable_acl: false,
|
87
|
+
fulltext_indexed: false,
|
88
|
+
included_in_supertype_query: true,
|
89
|
+
property_definitions: []
|
90
|
+
)
|
91
|
+
CmisServer::TypeRegistry.register_type('cmis:secondary', secondary_type)
|
92
|
+
end
|
93
|
+
|
94
|
+
Rails.logger.info "CMIS base types initialized: #{CmisServer::TypeRegistry.types.keys.join(', ')}"
|
95
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Configuration CMIS pour l'application Core
|
2
|
+
# Ce fichier configure les paramètres spécifiques pour l'utilisation du gem CMIS Server dans l'app core
|
3
|
+
|
4
|
+
Rails.application.config.after_initialize do
|
5
|
+
# Configuration du repository CMIS
|
6
|
+
CmisServer.configure do |config|
|
7
|
+
# Informations du repository principal
|
8
|
+
config.repository_info = {
|
9
|
+
id: 'core_repository',
|
10
|
+
name: 'Core Application Repository',
|
11
|
+
description: 'Repository CMIS pour l\'application Core',
|
12
|
+
vendor_name: 'Core Team',
|
13
|
+
product_name: 'Core Application',
|
14
|
+
product_version: '1.0.0'
|
15
|
+
}
|
16
|
+
|
17
|
+
# Configuration de base
|
18
|
+
config.debug = false
|
19
|
+
config.default_page_size = 100
|
20
|
+
|
21
|
+
# Configuration du dossier racine pour Core
|
22
|
+
config.arguments_for_root_folder = {
|
23
|
+
type: CmisServer::TypeRegistry.get_type('cmis:folder'),
|
24
|
+
properties: {
|
25
|
+
cmis_object_id: 'core_root',
|
26
|
+
cmis_name: 'Core Repository Root',
|
27
|
+
cmis_description: 'Dossier racine du repository Core',
|
28
|
+
cmis_last_modification_date: DateTime.now,
|
29
|
+
cmis_creation_date: DateTime.now,
|
30
|
+
cmis_created_by: 'core_system'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
# Configuration de l'authentification HTTP Basic - intégration avec le core
|
35
|
+
config.http_basic_auth_procedure = proc do |username, password|
|
36
|
+
# Utiliser les credentials du core et retourner un objet utilisateur
|
37
|
+
if username == 'oMkdOcS9qZhkHXoX2qO8u22vxlZij2me' && password == 'fGDmji2IMgIKd35pFwZ0Tm1lNQsm1O6z'
|
38
|
+
# Retourner un utilisateur simple - le connecteur se chargera de l'accès aux données
|
39
|
+
OpenStruct.new(
|
40
|
+
id: username,
|
41
|
+
name: 'Core User'
|
42
|
+
)
|
43
|
+
else
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Configuration des optimisations
|
49
|
+
config.optimizations = {
|
50
|
+
cache_types: true,
|
51
|
+
lazy_loading: true,
|
52
|
+
bulk_operations: true
|
53
|
+
}
|
54
|
+
|
55
|
+
# Configuration du connecteur pour Core
|
56
|
+
config.connector_class = 'CmisServer::Connectors::CoreConnector'
|
57
|
+
end
|
58
|
+
|
59
|
+
Rails.logger.info "CMIS Core configuration initialized for repository: #{CmisServer.configuration.repository_info[:id]}"
|
60
|
+
end
|