Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global folder and move folder contents up #2769

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "openslides-meta"]
path = global/meta
path = meta
url = https://github.com/OpenSlides/openslides-meta.git
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ENV PYTHONPATH /app
COPY --chown=appuser:appuser scripts scripts
COPY --chown=appuser:appuser entrypoint.sh ./
COPY --chown=appuser:appuser openslides_backend openslides_backend
COPY --chown=appuser:appuser global global
COPY --chown=appuser:appuser meta meta
COPY --chown=appuser:appuser data data

ARG VERSION=dev
RUN echo "$VERSION" > openslides_backend/version.txt
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development and testing inside docker container or without docker (only unit and integration tests)

paths = openslides_backend/ tests/ cli/ global/meta/dev/src/
paths = openslides_backend/ tests/ cli/ meta/dev/src/

all: pyupgrade black autoflake isort flake8 mypy

Expand Down Expand Up @@ -40,7 +40,7 @@ test-unit-integration:
check-all: validate-models-yml check-models check-initial-data-json check-example-data-json check-permissions

validate-models-yml:
make -C global/meta/dev validate-models
make -C meta/dev validate-models

generate-models:
python cli/generate_models.py $(MODELS_PATH)
Expand All @@ -57,10 +57,10 @@ check-permissions:
python cli/generate_permissions.py --check

check-initial-data-json:
python cli/check_json.py global/data/initial-data.json
python cli/check_json.py data/initial-data.json

check-example-data-json:
python cli/check_json.py global/data/example-data.json
python cli/check_json.py data/example-data.json

run-debug:
OPENSLIDES_DEVELOPMENT=1 python -m openslides_backend
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To generate a new models.py file run (inside the docker container)

$ make generate-models

The original models.yml is now included in this repository at global/meta/. If you do not want to generate from the current backend, you can provide either a local path or an URL via the variable `MODELS_PATH`. This way, you can generate only partial changes if multiple changes to the models file were merged into the main:
The original models.yml is now included in this repository at meta/. If you do not want to generate from the current backend, you can provide either a local path or a URL via the variable `MODELS_PATH`. This way, you can generate only partial changes if multiple changes to the models file were merged into the main:

$ MODEL_PATH="local path or GitHub link" make generate-models

Expand Down
2 changes: 1 addition & 1 deletion cli/generate_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)
from openslides_backend.shared.patterns import KEYSEPARATOR, Collection

SOURCE = "./global/meta/models.yml"
SOURCE = "./meta/models.yml"

DESTINATION = os.path.abspath(
os.path.join(
Expand Down
2 changes: 1 addition & 1 deletion cli/generate_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cli.util.util import assert_equal, open_output, open_yml_file, parse_arguments
from openslides_backend.permissions.get_permission_parts import get_permission_parts

SOURCE = "./global/meta/permission.yml"
SOURCE = "./meta/permission.yml"

DESTINATION = os.path.abspath(
os.path.join(
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion dev/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ COPY dev/cleanup.sh .

# Copy files which are mounted to make the full stack work
COPY scripts scripts
COPY global global
COPY cli cli
COPY data data
COPY meta meta

COPY Makefile .
COPY setup.cfg .
Expand Down
1 change: 0 additions & 1 deletion dev/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:
- ../openslides_backend:/app/openslides_backend
- ../tests:/app/tests
- ../cli:/app/cli
- ../global:/app/global
- ../scripts:/app/scripts
environment:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think, that the data and meta are missing in the docker compose part now.
Pls test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right. Everything was working but it should be included into the volumes. As well should requirements; to be more consistent.

- DATASTORE_READER_HOST=datastore-reader
Expand Down
2 changes: 1 addition & 1 deletion docs/actions/group.update.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
```

## Action
Updates the group. Permissions are restricted to the following enum: https://github.com/OpenSlides/openslides-backend/blob/fae36a0b055bbaa463da4768343080c285fe8178/global/meta/models.yml#L1621-L1656
Updates the group. Permissions are restricted to the group.permissions enum inside https://github.com/OpenSlides/openslides-meta/blob/main/models.yml.

If the group is the meetings anonymous group, the name may not be changed and the permissions have to be in the following whitelist:
- agenda_item.can_see,
Expand Down
4 changes: 2 additions & 2 deletions docs/actions/meeting.create.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
It has to be checked whether the `organization.limit_of_meetings` is unlimited (=0) or lower than the amount of active meetings in `organization.active_meeting_ids`.

When creating a meeting the following objects have to be created, too:
- Groups: `Default`, `Admin`, `Delegates`, `Staff`, `Committees`. The first one is set as `meeting/default_group_id`, the second one as `meeting/admin_group_id`. The permissions can be found in the [initial-data.json](https://github.com/OpenSlides/openslides-backend/tree/main/global/data/initial-data.json)).
- Groups: `Default`, `Admin`, `Delegates`, `Staff`, `Committees`. The first one is set as `meeting/default_group_id`, the second one as `meeting/admin_group_id`. The permissions can be found in the [initial-data.json](https://github.com/OpenSlides/openslides-backend/tree/main/data/initial-data.json)).
- Projector: One projector named `"Default projector"` must be created and set as `meeting/reference_projector_id`.
- All default projectors (`meeting/default_projector_*_ids`, see `models.yml`) must be set to the one projector
- Motion workflow and states: Create one workflow `"simple workflow"` which is set as `meeting/motions_default_workflow_id` and `meeting/motions_default_amendment_workflow_id`. Create four states (analog as in the [initial-data.json](https://github.com/OpenSlides/openslides-backend/tree/main/global/data/initial-data.json)).
- Motion workflow and states: Create one workflow `"simple workflow"` which is set as `meeting/motions_default_workflow_id` and `meeting/motions_default_amendment_workflow_id`. Create four states (analog as in the [initial-data.json](https://github.com/OpenSlides/openslides-backend/tree/main/data/initial-data.json)).
- Two countdowns are created and set as `meeting/list_of_speakers_countdown` (name: "List of speakers countdown") and `meeting/voting_countdown` (name: "Voting countdown").

If `user_ids` are given, it must be checked that it is a subset of `committee/user_ids`. Each user is added to the meeting by being added to the default group.
Expand Down
1 change: 0 additions & 1 deletion openslides_backend/http/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def create_initial_data(self) -> None:
Path(__file__).parent
/ ".."
/ ".."
/ "global"
/ "data"
/ f"{file_prefix}-data.json"
)
Expand Down
4 changes: 2 additions & 2 deletions openslides_backend/shared/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"word-wrap",
]

INITIAL_DATA_FILE = "global/data/initial-data.json"
EXAMPLE_DATA_FILE = "global/data/example-data.json"
INITIAL_DATA_FILE = "data/initial-data.json"
EXAMPLE_DATA_FILE = "data/example-data.json"
ONE_ORGANIZATION_ID = 1
ONE_ORGANIZATION_FQID = fqid_from_collection_and_id("organization", ONE_ORGANIZATION_ID)

Expand Down
2 changes: 1 addition & 1 deletion scripts/fetch-example-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e

file=${1:-example-data.json}
curl https://raw.githubusercontent.com/OpenSlides/openslides-backend/main/global/data/example-data.json --output $file
curl https://raw.githubusercontent.com/OpenSlides/openslides-backend/main/data/example-data.json --output $file
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The following sections must be kept in sync with global/meta/dev/setup.cfg
# The following sections must be kept in sync with meta/dev/setup.cfg

[autoflake]
verbose = true
Expand Down
10 changes: 6 additions & 4 deletions tests/system/action/mediafile/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

from openslides_backend.permissions.management_levels import OrganizationManagementLevel
from openslides_backend.permissions.permissions import Permissions
from openslides_backend.shared.util import ONE_ORGANIZATION_FQID, get_initial_data_file
from openslides_backend.shared.util import (
INITIAL_DATA_FILE,
ONE_ORGANIZATION_FQID,
get_initial_data_file,
)
from tests.system.action.base import BaseActionTestCase


Expand Down Expand Up @@ -472,9 +476,7 @@ def test_upload_json_detect_html(self) -> None:
"meeting/110", {"name": "name_DsJFXoot", "is_active_in_organization_id": 1}
)
filename = "test.json"
data = json.dumps(
get_initial_data_file("global/data/initial-data.json")
).encode()
data = json.dumps(get_initial_data_file(INITIAL_DATA_FILE)).encode()
json_content = base64.b64encode(data).decode()
response = self.request(
"mediafile.upload",
Expand Down
4 changes: 2 additions & 2 deletions tests/system/action/meeting/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,7 @@ def test_all_migrations(self) -> None:
@performance
def test_big_file(self) -> None:
data = {
"meeting": get_initial_data_file("global/data/put_your_file.json"),
"meeting": get_initial_data_file("data/put_your_file.json"),
"committee_id": 1,
}
with Profiler("test_meeting_import.prof"):
Expand Down Expand Up @@ -2642,7 +2642,7 @@ def test_delete_statutes(self) -> None:

@pytest.mark.skip()
def test_import_os3_data(self) -> None:
data_raw = get_initial_data_file("global/data/export-OS3-demo.json")
data_raw = get_initial_data_file("data/export-OS3-demo.json")
data = {"committee_id": 1, "meeting": data_raw}
response = self.request("meeting.import", data)
self.assert_status_code(response, 200)
2 changes: 1 addition & 1 deletion tests/system/action/organization/test_initial_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_initial_import_with_initial_data_file(self) -> None:

def test_initial_import_with_example_data_file(self) -> None:
self.datastore.truncate_db()
request_data = {"data": get_initial_data_file("global/data/example-data.json")}
request_data = {"data": get_initial_data_file("data/example-data.json")}
request_data["data"]["organization"]["1"]["default_language"] = "de"
response = self.request("organization.initial_import", request_data)
self.assert_status_code(response, 200)
Expand Down
Loading