Added meeting specific fields for users and changed role system.

This commit is contained in:
Norman Jäckel 2021-01-08 12:45:30 +01:00
parent 9abf787d99
commit c6b1a254a0
8 changed files with 284 additions and 160 deletions

View File

@ -2,12 +2,18 @@
"organisation": [
{
"id": 1,
"name": "OpenSlides",
"description": "The digital motion and assembly system",
"legal_notice": "<a href=\"http://www.openslides.org\">OpenSlides</a> is a free web based presentation and assembly system for visualizing and controlling agenda, motions and elections of an assembly.",
"openslides_theme": "openslides-theme",
"privacy_policy": "",
"login_text": "Welcome to OpenSlides. Please login.",
"theme": "openslides-theme",
"custom_translations": "",
"reset_password_verbose_errors": false,
"enable_electronic_voting": true,
"committee_ids": [1],
"role_ids": [1],
"superadmin_role_id": 1,
"resource_ids": []
}],
"user": [
@ -18,51 +24,45 @@
"first_name": "",
"last_name": "Administrator",
"is_active": true,
"is_committee": false,
"is_physical_person": true,
"password": "1422e767c5e08bb7196844025a0f98e1x61Ey612Kl2gpFL56FT9weDnpSo4AV8j8+qx2AuTHdRyY036xxzTTrw10Wq3+4qQyB+XURPWx1ONxp3Y3pB37A==",
"default_password": "admin",
"about_me": "",
"gender": "",
"comment": "",
"number": "",
"structure_level": "",
"email": "",
"default_number": "",
"default_structure_level": "",
"default_vote_weight": "1.000000",
"last_email_send": null,
"vote_weight": "1.000000",
"role_id": 1,
"is_demo_user": false,
"organisation_management_level": "superadmin",
"is_present_in_meeting_ids": [],
"meeting_id": null,
"guest_meeting_ids": [],
"committee_as_member_ids": [],
"committee_as_manager_ids": [],
"projection_ids": [],
"current_projector_ids": [],
"comment_$": [],
"number_$": [],
"structure_level_$": [],
"about_me_$": [],
"vote_weight_$": [],
"group_$_ids": ["1"],
"group_1_ids": [2],
"group_$1_ids": [2],
"speaker_$_ids": [],
"personal_note_$_ids": [],
"supported_motion_$_ids": [],
"submitted_motion_$_ids": [],
"motion_poll_voted_$_ids": [],
"motion_vote_$_ids": [],
"poll_voted_$_ids": [],
"option_$_ids": [],
"vote_$_ids": [],
"vote_delegated_vote_$_ids": [],
"assignment_candidate_$_ids": [],
"assignment_poll_voted_$_ids": [],
"assignment_option_$_ids": [],
"assignment_vote_$_ids": []
}],
"role": [
{
"id": 1,
"name": "Superadmin role",
"permissions": [],
"organisation_id": 1,
"superadmin_role_for_organisation_id": 1,
"user_ids": [1]
"projection_$_ids": [],
"current_projector_$_ids": [],
"vote_delegated_$_to_id": [],
"vote_delegations_$_from_ids": []
}],
"resource": [],
"committee": [
@ -83,23 +83,30 @@
"meeting": [
{
"id": 1,
"url_name": "os3_test",
"template_for_committee_id": null,
"enable_anonymous": false,
"welcome_title": "Welcome to OpenSlides",
"welcome_text": "[Space for your welcome text.]",
"name": "OpenSlides - Die Veranstaltung (Teil II)",
"description": "Presentation and assembly system",
"location": "",
"start_time": 0,
"end_time": 0,
"welcome_title": "Welcome to OpenSlides",
"welcome_text": "[Space for your welcome text.]",
"custom_translations": [],
"jitsi_domain": "",
"jitsi_room_name": "",
"jitsi_room_password": "",
"url_name": "openslides_1",
"template_for_committee_id": null,
"enable_anonymous": false,
"conference_show": false,
"conference_auto_connect": false,
"conference_los_restriction": false,
"conference_stream_url": "",
"conference_open_microphone": true,
"conference_open_video": true,
"conference_auto_connect_next_speakers": true,
"projector_default_countdown_time": 60,
"projector_countdown_warning_time": 0,
@ -124,9 +131,11 @@
"list_of_speakers_show_amount_of_speakers_on_slide": true,
"list_of_speakers_present_users_only": false,
"list_of_speakers_show_first_contribution": false,
"list_of_speakers_enable_point_of_order_speakers": true,
"motions_default_workflow_id": 1,
"motions_statute_amendment_workflow_id": 1,
"motions_default_amendment_workflow_id": 1,
"motions_default_statute_amendment_workflow_id": 1,
"motions_preamble": "The assembly may decide:",
"motions_default_line_numbering": "none",
"motions_line_length": 90,
@ -136,7 +145,7 @@
"motions_enable_sidebox_on_projector": false,
"motions_enable_recommendation_on_projector": true,
"motions_show_referring_motions": true,
"motions_show_sequential_numbers": true,
"motions_show_sequential_number": true,
"motions_recommendations_by": "",
"motions_statute_recommendations_by": "",
"motions_recommendation_text_mode": "original",
@ -152,7 +161,6 @@
"motions_amendments_text_mode": "freestyle",
"motions_amendments_multiple_paragraphs": true,
"motions_supporters_min_amount": 1,
"motions_supporters_autoremove": false,
"motions_export_title": "Motions",
"motions_export_preamble": "",
"motions_export_submitter_recommendation": false,
@ -191,6 +199,7 @@
"assignment_poll_default_group_ids": [3, 5],
"projector_ids": [1],
"projection_ids": [],
"projectiondefault_ids": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
"projector_message_ids": [],
"projector_countdown_ids": [],
@ -206,9 +215,16 @@
"motion_block_ids": [],
"motion_workflow_ids": [1],
"motion_statute_paragraph_ids": [],
"motion_poll_ids": [],
"motion_comment_ids": [],
"motion_submitter_ids": [],
"motion_change_recommendation_ids": [],
"motion_state_ids": [],
"poll_ids": [],
"option_ids": [],
"vote_ids": [],
"assignment_ids": [],
"assignment_poll_ids": [],
"assignment_candidate_ids": [],
"personal_note_ids": [],
"logo_$_id": [],
"font_$_id": [],
@ -216,9 +232,9 @@
"committee_id": 1,
"default_meeting_for_committee_id": 1,
"present_user_ids": [],
"temorary_user_ids": [],
"temporary_user_ids": [],
"guest_ids": [],
"user_ids": [],
"user_ids": [1],
"reference_projector_id": 2,
"default_group_id": 1,
@ -228,8 +244,6 @@
{
"id": 1,
"name": "Default",
"admin_group_for_meeting_id": null,
"default_group_for_meeting_id": 1,
"permissions": [
"agenda_item.can_see",
"agenda_item.can_see_internals",
@ -240,12 +254,15 @@
"motion.can_see",
"user.can_see"
],
"user_ids": [],
"default_group_for_meeting_id": 1,
"admin_group_for_meeting_id": null,
"mediafile_access_group_ids": [],
"mediafile_inherited_access_group_ids": [],
"read_comment_section_ids": [],
"write_comment_section_ids": [],
"motion_poll_ids": [],
"assignment_poll_ids": [],
"poll_ids": [],
"used_as_motion_poll_default_id": null,
"used_as_assignment_poll_default_id": null,
"meeting_id": 1
@ -253,25 +270,23 @@
{
"id": 2,
"name": "Admin",
"admin_group_for_meeting_id": 1,
"default_group_for_meeting_id": null,
"permissions": [],
"user_ids": [],
"user_ids": [1],
"default_group_for_meeting_id": null,
"admin_group_for_meeting_id": 1,
"mediafile_access_group_ids": [],
"mediafile_inherited_access_group_ids": [],
"read_comment_section_ids": [],
"write_comment_section_ids": [],
"motion_poll_ids": [],
"assignment_poll_ids": [],
"used_as_motion_poll_default_id": 1,
"poll_ids": [],
"used_as_motion_poll_default_id": null,
"used_as_assignment_poll_default_id": null,
"meeting_id": 1
},
{
"id": 3,
"name": "Staff",
"admin_group_for_meeting_id": null,
"default_group_for_meeting_id": null,
"permissions": [
"agenda_item.can_manage",
"agenda_item.can_see",
@ -296,21 +311,20 @@
],
"user_ids": [],
"default_group_for_meeting_id": null,
"admin_group_for_meeting_id": null,
"mediafile_access_group_ids": [],
"mediafile_inherited_access_group_ids": [],
"read_comment_section_ids": [],
"write_comment_section_ids": [],
"motion_poll_ids": [],
"assignment_poll_ids": [],
"used_as_motion_poll_default_id": 1,
"used_as_assignment_poll_default_id": 1,
"poll_ids": [],
"used_as_motion_poll_default_id": null,
"used_as_assignment_poll_default_id": null,
"meeting_id": 1
},
{
"id": 5,
"name": "Committees",
"admin_group_for_meeting_id": null,
"default_group_for_meeting_id": null,
"permissions": [
"agenda_item.can_see",
"agenda_item.can_see_internals",
@ -325,20 +339,20 @@
],
"user_ids": [],
"default_group_for_meeting_id": null,
"admin_group_for_meeting_id": null,
"mediafile_access_group_ids": [],
"mediafile_inherited_access_group_ids": [],
"read_comment_section_ids": [],
"write_comment_section_ids": [],
"motion_poll_ids": [],
"assignment_poll_ids": [],
"poll_ids": [],
"used_as_motion_poll_default_id": null,
"used_as_assignment_poll_default_id": 1,
"used_as_assignment_poll_default_id": null,
"meeting_id": 1
},
{
"id": 6,
"name": "Delegates",
"admin_group_for_meeting_id": null,
"default_group_for_meeting_id": null,
"permissions": [
"agenda_item.can_see",
"agenda_item.can_see_internals",
@ -357,13 +371,15 @@
],
"user_ids": [],
"default_group_for_meeting_id": null,
"admin_group_for_meeting_id": null,
"mediafile_access_group_ids": [],
"mediafile_inherited_access_group_ids": [],
"read_comment_section_ids": [],
"write_comment_section_ids": [],
"motion_poll_ids": [],
"assignment_poll_ids": [],
"used_as_motion_poll_default_id": null,
"used_as_assignment_poll_default_id": null,
"poll_ids": [],
"used_as_motion_poll_default_id": 1,
"used_as_assignment_poll_default_id": 1,
"meeting_id": 1
}],
"personal_note": [],
@ -399,7 +415,8 @@
"motion_ids": [],
"motion_recommendation_ids": [],
"workflow_id": 1,
"first_state_of_workflow_id": 1
"first_state_of_workflow_id": 1,
"meeting_id": 1
},
{
"id": 2,
@ -420,7 +437,8 @@
"motion_ids": [],
"motion_recommendation_ids": [],
"workflow_id": 1,
"first_state_of_workflow_id": null
"first_state_of_workflow_id": null,
"meeting_id": 1
},
{
"id": 3,
@ -441,7 +459,8 @@
"motion_ids": [],
"motion_recommendation_ids": [],
"workflow_id": 1,
"first_state_of_workflow_id": null
"first_state_of_workflow_id": null,
"meeting_id": 1
},
{
"id": 4,
@ -462,7 +481,8 @@
"motion_ids": [],
"motion_recommendation_ids": [],
"workflow_id": 1,
"first_state_of_workflow_id": null
"first_state_of_workflow_id": null,
"meeting_id": 1
}
],
"motion_workflow": [
@ -473,18 +493,16 @@
"state_ids": [1, 2, 3, 4],
"first_state_id": 1,
"default_workflow_meeting_id": 1,
"default_statute_amendments_meeting_id": 1,
"default_amendment_workflow_meeting_id": 1,
"default_statute_amendment_workflow_meeting_id": 1,
"meeting_id": 1
}],
"motion_statute_paragraph": [],
"motion_poll": [],
"motion_option": [],
"motion_vote": [],
"poll": [],
"option": [],
"vote": [],
"assignment": [],
"assignment_candidate": [],
"assignment_poll": [],
"assignment_option": [],
"assignment_vote": [],
"mediafile": [],
"projector": [
{

View File

@ -4,13 +4,11 @@
"id": 1,
"legal_notice": "<a href=\"http://www.openslides.org\">OpenSlides</a> is a free web based presentation and assembly system for visualizing and controlling agenda, motions and elections of an assembly.",
"privacy_policy": "",
"login_info_text": "Guten Morgen!",
"openslides_theme": "openslides-theme",
"login_text": "Guten Morgen!",
"theme": "openslides-theme",
"custom_translations": [],
"committee_ids": [1],
"role_ids": [1],
"superadmin_role_id": 1,
"resource_ids": [1]
}],
"user": [
@ -24,16 +22,14 @@
"is_physical_person": true,
"password": "316af7b2ddc20ead599c38541fbe87e9a9e4e960d4017d6e59de188b41b2758flD5BVZAZ8jLy4nYW9iomHcnkXWkfk3PgBjeiTSxjGG7+fBjMBxsaS1vIiAMxYh+K38l0gDW4wcP+i8tgoc4UBg==",
"default_password": "admin",
"about_me": "",
"gender": "",
"comment": "",
"number": "",
"structure_level": "",
"email": "",
"default_number": "",
"default_structure_level": "",
"default_vote_weight": "1.000000",
"last_email_send": null,
"vote_weight": "1.000000",
"role_id": 1,
"organisation_management_level": "superadmin",
"is_present_in_meeting_ids": [1],
"meeting_id": null,
@ -41,6 +37,17 @@
"committee_as_member_ids": [],
"committee_as_manager_ids": [],
"comment_$": ["1"],
"comment_$1": "Test comment",
"number_$": ["1"],
"number_$1": "12345-67890",
"structure_level_$": ["1"],
"structure_level_$1": "Test structure level",
"about_me_$": ["1"],
"about_me_$1": "What I want to say about me.",
"vote_weight_$": ["1"],
"vote_weight_$1": "1.000000",
"group_$_ids": ["1"],
"group_$1_ids": [2],
"speaker_$_ids": ["1"],
@ -75,16 +82,14 @@
"is_physical_person": true,
"password": "316af7b2ddc20ead599c38541fbe87e9a9e4e960d4017d6e59de188b41b2758fDB3tv5HcCtPRREt7bPGqerTf1AbmoKXt/fVFkLY4znDRh2Yy0m3ZjXD0nHI8oa6KrGlHH/cvysfvf8i2fWIzmw==",
"default_password": "a",
"about_me": "",
"gender": "",
"comment": "",
"number": "",
"structure_level": "",
"email": "",
"default_number": "",
"default_structure_level": "",
"default_vote_weight": "1.000000",
"last_email_send": null,
"vote_weight": "1.000000",
"role_id": null,
"organisation_management_level": "",
"is_present_in_meeting_ids": [],
"meeting_id": null,
@ -92,6 +97,17 @@
"committee_as_member_ids": [],
"committee_as_manager_ids": [],
"comment_$": ["1"],
"comment_$1": "Test comment a",
"number_$": ["1"],
"number_$1": "12345-67891",
"structure_level_$": ["1"],
"structure_level_$1": "Test structure level a",
"about_me_$": ["1"],
"about_me_$1": "What I want to say about me with a",
"vote_weight_$": ["1"],
"vote_weight_$1": "1.000000",
"group_$_ids": ["1"],
"group_$1_ids": [6],
"speaker_$_ids": ["1"],
@ -121,16 +137,14 @@
"is_physical_person": true,
"password": "316af7b2ddc20ead599c38541fbe87e9a9e4e960d4017d6e59de188b41b2758fIxDxvpkn6dDLRxT9DxJhZ/f04AL2oK2beICRFobSw53CI93U+dfN+w+NaL7BvrcR4JWuMj9NkH4dVjnnI0YTkg==",
"default_password": "jKwSLGCk",
"about_me": "",
"gender": "",
"comment": "",
"number": "",
"structure_level": "",
"email": "",
"default_number": "",
"default_structure_level": "",
"default_vote_weight": "1.000000",
"last_email_send": null,
"vote_weight": "1.000000",
"role_id": null,
"organisation_management_level": "",
"is_present_in_meeting_ids": [],
"meeting_id": null,
@ -138,6 +152,17 @@
"committee_as_member_ids": [],
"committee_as_manager_ids": [],
"comment_$": ["1"],
"comment_$1": "Test comment b as guest",
"number_$": ["1"],
"number_$1": "12345-67892",
"structure_level_$": ["1"],
"structure_level_$1": "Test structure level b",
"about_me_$": ["1"],
"about_me_$1": "What I want to say about me. B",
"vote_weight_$": ["1"],
"vote_weight_$1": "1.000000",
"group_$_ids": [],
"speaker_$_ids": ["1"],
"speaker_$1_ids": [4, 8, 9],
@ -157,16 +182,6 @@
"vote_delegated_$_to_id": [],
"vote_delegations_$_from_ids": []
}],
"role": [
{
"id": 1,
"name": "Superadmin role",
"permissions": [],
"organisation_id": 1,
"superadmin_role_for_organisation_id": 1,
"user_ids": [1]
}],
"resource": [
{
"id": 1,
@ -205,7 +220,6 @@
"end_time": 0,
"welcome_title": "Welcome to OpenSlides",
"welcome_text": "[Space for your welcome text.]",
"custom_translations": [],
"conference_show": false,
"conference_auto_connect": false,
@ -253,7 +267,7 @@
"motions_enable_sidebox_on_projector": true,
"motions_enable_recommendation_on_projector": true,
"motions_show_referring_motions": true,
"motions_show_sequential_numbers": true,
"motions_show_sequential_number": true,
"motions_recommendations_by": "ABK",
"motions_statute_recommendations_by": "Statute ABK",
"motions_recommendation_text_mode": "original",
@ -1296,8 +1310,7 @@
"submitter_ids": [1],
"supporter_ids": [],
"poll_ids": [1, 2],
"option_$_ids": ["1"],
"option_$1_ids": [1, 2],
"option_ids": [1, 3],
"change_recommendation_ids": [],
"statute_paragraph_id": null,
"comment_ids": [1],
@ -1342,7 +1355,7 @@
"submitter_ids": [2],
"supporter_ids": [],
"poll_ids": [],
"option_$_ids": [],
"option_ids": [],
"change_recommendation_ids": [],
"statute_paragraph_id": null,
"comment_ids": [],
@ -1387,7 +1400,7 @@
"submitter_ids": [3],
"supporter_ids": [3],
"poll_ids": [],
"option_$_ids": [],
"option_ids": [],
"change_recommendation_ids": [5],
"statute_paragraph_id": null,
"comment_ids": [],
@ -1432,7 +1445,7 @@
"submitter_ids": [4],
"supporter_ids": [],
"poll_ids": [],
"option_$_ids": [],
"option_ids": [],
"change_recommendation_ids": [4],
"statute_paragraph_id": null,
"comments": [],

View File

@ -81,12 +81,6 @@ organisation:
committee_ids:
type: relation-list
to: committee/organisation_id
role_ids:
type: relation-list
to: role/organisation_id
superadmin_role_id:
type: relation
to: role/superadmin_role_for_organisation_id
resource_ids:
type: relation-list
to: resource/organisation_id
@ -103,28 +97,24 @@ user:
default: true
password: string
default_password: string
about_me: HTMLStrict
gender: string
comment: HTMLStrict
number: string
structure_level: string
email: string
default_number: string
default_structure_level: string
default_vote_weight: decimal(6)
last_email_send: string
vote_weight: decimal(6)
is_demo_user:
type: boolean
read_only: true
role_id:
type: relation
to: role/user_ids # Attention: prevent impelenting a "default-role" or let a
# user create such a role! This would cause the user_ids-array for this
# role to explode in size. If a user has no role, it should be handles as
# the user has no permission in the organisation and is a "normal" delegate
# there. Just a few users (expected <100) should even get a role and all
# other don't.
# Meeting and committee
# Organisation, meeting and committee
organisation_management_level:
type: string
description: Hierarchical permission level for the whole organisation.
enum:
- superadmin
- can_manage_organisation
- can_manage_users
is_present_in_meeting_ids:
type: relation-list
to: meeting/present_user_ids
@ -141,6 +131,24 @@ user:
type: relation-list
to: committee/manager_ids
# Meeting specific personal data
# Replacement is te meeting id but it is not a structured relation.
comment_$:
type: template
fields: HTMLStrict
number_$:
type: template
fields: string
structure_level_$:
type: template
fields: string
about_me_$:
type: template
fields: HTMLStrict
vote_weight_$:
type: template
fields: decimal(6)
# All foreign keys are meeting-specific:
# - Keys are smaller (Space is in O(n^2) for n keys
# in the relation), so this saves storagespace
@ -233,21 +241,6 @@ user:
type: relation-list
to: user/vote_delegated_$_to_id
role:
id: number
name: string
permissions: string[]
organisation_id:
type: relation
to: organisation/role_ids
superadmin_role_for_organisation_id:
type: relation
to: organisation/superadmin_role_id
user_ids:
type: relation-list
to: user/role_id
# New: Resource
# Resources are organsation wide "mediafiles", like logos for the organisatio or
# organisation-wide fonts. Therefore, no permission checks are done and the user
@ -641,7 +634,7 @@ meeting:
users_email_body: string
# Assignments
assignemnts_export_title:
assignments_export_title:
type: string
default: Elections
assignments_export_preamble:

View File

@ -0,0 +1,100 @@
# This script requires fastjsonschema and pyyaml to be installed e. g. via pip.
import json
import sys
from typing import Any, Dict, Iterable
import fastjsonschema # type:ignore
import yaml
MODELS_YML_PATH = "../../docs/models.yml"
CHECKED_FILES = [
"../../docker/initial-data.json",
"../../docs/example-data.json",
]
SCHEMA = fastjsonschema.compile(
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Schema for initial and example data.",
"type": "object",
"patternProperties": {
"^[a-z_]+$": {
"type": "array",
"items": {
"type": "object",
"properties": {"id": {"type": "number"}},
"required": ["id"],
},
}
},
"additionalProperties": False,
}
)
class CheckException(Exception):
pass
def run_check(data: Dict) -> None:
try:
SCHEMA(data)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise CheckException(f"JSON does not match schema: {str(e)}")
check_collections(data.keys())
for collection, elements in data.items():
for element in elements:
check_instance(collection, element)
def get_models() -> Dict[str, Any]:
with open(MODELS_YML_PATH, "rb") as x:
models_yml = x.read()
models_yml = models_yml.replace(" yes:".encode(), ' "yes":'.encode())
models_yml = models_yml.replace(" no:".encode(), ' "no":'.encode())
return yaml.safe_load(models_yml)
def check_collections(collections: Iterable[str]) -> None:
c1 = set(collections)
c2 = set(get_models().keys())
if c1 != c2:
err = "Collections in JSON file do not match with models.yml."
if c2 - c1:
err += f" Missing collections: {', '.join(c2-c1)}."
if c1 - c2:
err += f" Invalid collections: {', '.join(c1-c2)}."
raise CheckException(err)
def check_instance(name: str, instance: Dict[str, Any]) -> None:
collection = get_models()[name]
for field_name in instance.keys():
if "$" in field_name and not ("$_" in field_name or field_name[-1] == "$"):
# Structured field.
# TODO: Check this.
continue
if field_name not in collection.keys():
raise CheckException(f"Bad field in {name}: {field_name}")
def main() -> int:
failed = False
for f in CHECKED_FILES:
with open(f) as data:
try:
run_check(json.load(data))
except CheckException as e:
print(f"Check for {f} failed:", e)
failed = True
else:
print(f"Check for {f} successful.")
if failed:
return 1
return 0
if __name__ == "__main__":
sys.exit(main())

@ -1 +1 @@
Subproject commit 8caa333f9139e81d36ce775e25d3555ed14c9f15
Subproject commit 667b32e2306ecfcfe3273c92c1e46c2f11055c06

@ -1 +1 @@
Subproject commit 1ac2192ac3bdfe18e3468e00197bfb067b69b112
Subproject commit 193149e9b6e50862f17ea278ba3b660eb1826589

@ -1 +1 @@
Subproject commit 6db3ecb09ecc4b49b20bb7fb6b24a057678ea27f
Subproject commit cdf1b72b2252d1179d8e4a548f23b8df31e33c4c

@ -1 +1 @@
Subproject commit 532f86b21c392bcdc9cab6d24351f9905c739214
Subproject commit a7c93cf9db1f29de57c07b05a3fefd63b0900ec7