Skip to content

Commit 32fb1ba

Browse files
committed
Merge branch 'async' into publish-exchange-system
2 parents 0825412 + 2681c75 commit 32fb1ba

16 files changed

+1872
-30
lines changed

apps/content_types/content_types.py

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555

5656
class ContentTypesResource(superdesk.Resource):
57+
internal_resource = True
5758
schema = {
5859
"_id": {
5960
"type": "string",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from superdesk.core.module import Module
2+
from .service import ContentTypesService
3+
from .module import content_types_resource_config
4+
5+
__all__ = ["ContentTypesService"]
6+
7+
module = Module(name="superdesk.content_types_async", resources=[content_types_resource_config])
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file is part of Superdesk.
2+
#
3+
# Copyright 2013, 2025 Sourcefabric z.u. and contributors.
4+
#
5+
# For the full copyright and license information, please see the
6+
# AUTHORS and LICENSE files distributed with this source code, or
7+
# at https://www.sourcefabric.org/superdesk/license
8+
9+
from apps.content_types.content_types import CONTENT_TYPE_PRIVILEGE
10+
from superdesk.core.resources import ResourceConfig, MongoResourceConfig, MongoIndexOptions
11+
from superdesk.core.resources.resource_rest_endpoints import RestEndpointConfig
12+
from superdesk.types.content_types import ContentTypes
13+
from .service import ContentTypesService
14+
from superdesk.core.auth.privilege_rules import http_method_privilege_based_rules
15+
16+
17+
content_types_resource_config = ResourceConfig(
18+
name="content_types",
19+
data_class=ContentTypes,
20+
service=ContentTypesService,
21+
mongo=MongoResourceConfig(
22+
indexes=[
23+
MongoIndexOptions(name="label_1", keys=[("label", 1)], unique=True),
24+
],
25+
),
26+
default_sort=[("priority", -1)],
27+
rest_endpoints=RestEndpointConfig(
28+
id_param_type=r'regex("[\w,.:-]+")',
29+
auth=http_method_privilege_based_rules(
30+
{
31+
"POST": CONTENT_TYPE_PRIVILEGE,
32+
"PATCH": CONTENT_TYPE_PRIVILEGE,
33+
"DELETE": CONTENT_TYPE_PRIVILEGE,
34+
}
35+
),
36+
),
37+
)

0 commit comments

Comments
 (0)