@@ -47,6 +47,8 @@ case "$COMMAND" in
4747 patch -d " ${WEKO_ROOT} " -p1 < " ${SCRIPT_DIR} /../patches/weko-oauth2-insecure-transport.patch"
4848 # Apply patch to fix chardet TypeError on ZIP filename handling
4949 patch -d " ${WEKO_ROOT} " -p1 < " ${SCRIPT_DIR} /../patches/weko-chardet-fix.patch"
50+ # Apply patch to delay file content extraction task to avoid ES version conflict
51+ patch -d " ${WEKO_ROOT} " -p1 < " ${SCRIPT_DIR} /../patches/weko-delay-file-content-task.patch"
5052 # Generate self-signed certificate for WEKO nginx with SAN for IP address
5153 mkdir -p " ${WEKO_ROOT} /nginx/keys"
5254 openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
@@ -89,6 +91,44 @@ db.session.commit()
8991print('Updated mapping 30002')
9092"
9193
94+ # Grant contributor access to Sample Index
95+ echo " === Granting Contributor Access to Sample Index ==="
96+ docker compose -f " ${compose_file} " exec -T web invenio shell -c '
97+ from weko_index_tree.models import Index
98+ from invenio_db import db
99+ index = Index.query.filter_by(index_name_english="Sample Index").first()
100+ if index:
101+ print(f"Before: contribute_role={index.contribute_role}, browsing_role={index.browsing_role}")
102+ index.contribute_role = "1,2,3,4,-98,-99"
103+ index.browsing_role = "1,2,3,4,-98,-99"
104+ index.public_state = True
105+ db.session.commit()
106+ print(f"After: contribute_role={index.contribute_role}, browsing_role={index.browsing_role}")
107+ else:
108+ print("Sample Index not found")
109+ exit(1)
110+ '
111+
112+ # Grant index-tree-access permission to Contributor role
113+ echo " === Granting index-tree-access to Contributor ==="
114+ docker compose -f " ${compose_file} " exec -T web invenio shell -c '
115+ from invenio_access.models import ActionRoles, Role
116+ from invenio_db import db
117+ role = Role.query.filter_by(name="Contributor").first()
118+ if role:
119+ existing = ActionRoles.query.filter_by(action="index-tree-access", role_id=role.id).first()
120+ if existing:
121+ print(f"index-tree-access already granted to Contributor (role_id={role.id})")
122+ else:
123+ ar = ActionRoles(action="index-tree-access", role_id=role.id)
124+ db.session.add(ar)
125+ db.session.commit()
126+ print(f"Granted index-tree-access to Contributor (role_id={role.id})")
127+ else:
128+ print("Contributor role not found")
129+ exit(1)
130+ '
131+
92132 # Validate SWORD mapping 30002
93133 echo " === SWORD Mapping Validation (30002) ==="
94134 validation_result=$( docker compose -f " ${compose_file} " exec -T web invenio shell -c '
0 commit comments