1- # Generated by Django 5.0.6 on 2025-01-22 05:49
1+ # Generated by Django 5.2b1 on 2025-03-01 00:11
22
33import django .contrib .auth .validators
44import django .db .models .deletion
55import django .utils .timezone
6+ import iam .models .utils
7+ import uuid
8+ from django .conf import settings
69from django .db import migrations , models
710
811
@@ -16,30 +19,39 @@ class Migration(migrations.Migration):
1619
1720 operations = [
1821 migrations .CreateModel (
19- name = 'OrganizationType ' ,
22+ name = 'Organization ' ,
2023 fields = [
2124 ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
22- ('name' , models .CharField (max_length = 255 , unique = True )),
23- ('public' , models .BooleanField (default = True )),
25+ ('code' , models .CharField (max_length = 255 )),
26+ ('name' , models .CharField (max_length = 255 )),
27+ ('description' , models .TextField (blank = True , null = True )),
28+ ('link' , models .URLField (blank = True , max_length = 2000 , null = True )),
29+ ('organization_type' , models .CharField (max_length = 255 )),
2430 ],
2531 ),
2632 migrations .CreateModel (
27- name = 'UserType ' ,
33+ name = 'OrganizationType ' ,
2834 fields = [
2935 ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
3036 ('name' , models .CharField (max_length = 255 , unique = True )),
3137 ('public' , models .BooleanField (default = True )),
3238 ],
3339 ),
3440 migrations .CreateModel (
35- name = 'Organization ' ,
41+ name = 'Role ' ,
3642 fields = [
37- ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
38- ('code' , models .CharField (max_length = 255 )),
43+ ('id' , models .UUIDField (default = uuid .uuid4 , editable = False , primary_key = True , serialize = False )),
3944 ('name' , models .CharField (max_length = 255 )),
4045 ('description' , models .TextField (blank = True , null = True )),
41- ('link' , models .URLField (blank = True , max_length = 2000 , null = True )),
42- ('_organization_type' , models .ForeignKey (blank = True , db_column = 'organization_type_id' , null = True , on_delete = django .db .models .deletion .SET_NULL , to = 'iam.organizationtype' )),
46+ ],
47+ bases = (models .Model , iam .models .utils .PermissionChecker ),
48+ ),
49+ migrations .CreateModel (
50+ name = 'UserType' ,
51+ fields = [
52+ ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
53+ ('name' , models .CharField (max_length = 255 , unique = True )),
54+ ('public' , models .BooleanField (default = True )),
4355 ],
4456 ),
4557 migrations .CreateModel (
@@ -60,16 +72,69 @@ class Migration(migrations.Migration):
6072 ('phone' , models .CharField (blank = True , max_length = 15 , null = True )),
6173 ('address' , models .CharField (blank = True , max_length = 255 , null = True )),
6274 ('link' , models .URLField (blank = True , max_length = 2000 , null = True )),
75+ ('user_type' , models .CharField (max_length = 255 )),
6376 ('is_ownership_allowed' , models .BooleanField (default = False )),
6477 ('groups' , models .ManyToManyField (blank = True , help_text = 'The groups this user belongs to. A user will get all permissions granted to each of their groups.' , related_name = 'user_set' , related_query_name = 'user' , to = 'auth.group' , verbose_name = 'groups' )),
6578 ('user_permissions' , models .ManyToManyField (blank = True , help_text = 'Specific permissions for this user.' , related_name = 'user_set' , related_query_name = 'user' , to = 'auth.permission' , verbose_name = 'user permissions' )),
6679 ('organization' , models .OneToOneField (blank = True , null = True , on_delete = django .db .models .deletion .SET_NULL , related_name = 'user' , to = 'iam.organization' )),
67- ('_user_type' , models .ForeignKey (db_column = 'user_type_id' , on_delete = django .db .models .deletion .PROTECT , to = 'iam.usertype' )),
6880 ],
6981 options = {
7082 'verbose_name' : 'user' ,
7183 'verbose_name_plural' : 'users' ,
7284 'abstract' : False ,
7385 },
7486 ),
87+ migrations .CreateModel (
88+ name = 'Permission' ,
89+ fields = [
90+ ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
91+ ('permission_type' , models .CharField (choices = [('*' , 'Full' ), ('view' , 'View' ), ('create' , 'Create' ), ('edit' , 'Edit' ), ('delete' , 'Delete' )], max_length = 50 )),
92+ ('resource_type' , models .CharField (choices = [('*' , 'All' ), ('APIKey' , 'API Key' ), ('Role' , 'Role' ), ('Collaborator' , 'Collaborator' ), ('DataSource' , 'Data Source' ), ('ETLSystem' , 'ETL System' ), ('Thing' , 'Thing' ), ('Datastream' , 'Datastream' ), ('Observation' , 'Observation' ), ('Sensor' , 'Sensor' ), ('ObservedProperty' , 'Observed Property' ), ('ProcessingLevel' , 'Processing Level' ), ('Unit' , 'Unit' ), ('ResultQualifier' , 'Result Qualifier' )], max_length = 50 )),
93+ ('role' , models .ForeignKey (on_delete = django .db .models .deletion .DO_NOTHING , related_name = 'permissions' , to = 'iam.role' )),
94+ ],
95+ ),
96+ migrations .CreateModel (
97+ name = 'Workspace' ,
98+ fields = [
99+ ('id' , models .UUIDField (default = uuid .uuid4 , editable = False , primary_key = True , serialize = False )),
100+ ('name' , models .CharField (max_length = 255 )),
101+ ('is_private' , models .BooleanField (default = False )),
102+ ('owner' , models .ForeignKey (on_delete = django .db .models .deletion .DO_NOTHING , to = settings .AUTH_USER_MODEL )),
103+ ],
104+ ),
105+ migrations .AddField (
106+ model_name = 'role' ,
107+ name = 'workspace' ,
108+ field = models .ForeignKey (blank = True , null = True , on_delete = django .db .models .deletion .DO_NOTHING , related_name = 'roles' , to = 'iam.workspace' ),
109+ ),
110+ migrations .CreateModel (
111+ name = 'WorkspaceDeleteConfirmation' ,
112+ fields = [
113+ ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
114+ ('initiated' , models .DateTimeField ()),
115+ ('workspace' , models .OneToOneField (on_delete = django .db .models .deletion .CASCADE , related_name = 'delete_confirmation' , to = 'iam.workspace' )),
116+ ],
117+ ),
118+ migrations .CreateModel (
119+ name = 'WorkspaceTransferConfirmation' ,
120+ fields = [
121+ ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
122+ ('initiated' , models .DateTimeField ()),
123+ ('new_owner' , models .ForeignKey (on_delete = django .db .models .deletion .CASCADE , to = settings .AUTH_USER_MODEL )),
124+ ('workspace' , models .OneToOneField (on_delete = django .db .models .deletion .CASCADE , related_name = 'transfer_confirmation' , to = 'iam.workspace' )),
125+ ],
126+ ),
127+ migrations .CreateModel (
128+ name = 'Collaborator' ,
129+ fields = [
130+ ('id' , models .BigAutoField (auto_created = True , primary_key = True , serialize = False , verbose_name = 'ID' )),
131+ ('user' , models .ForeignKey (on_delete = django .db .models .deletion .DO_NOTHING , related_name = 'workspace_roles' , to = settings .AUTH_USER_MODEL )),
132+ ('role' , models .ForeignKey (on_delete = django .db .models .deletion .DO_NOTHING , related_name = 'collaborator_assignments' , to = 'iam.role' )),
133+ ('workspace' , models .ForeignKey (on_delete = django .db .models .deletion .DO_NOTHING , related_name = 'collaborators' , to = 'iam.workspace' )),
134+ ],
135+ options = {
136+ 'unique_together' : {('user' , 'workspace' )},
137+ },
138+ bases = (models .Model , iam .models .utils .PermissionChecker ),
139+ ),
75140 ]
0 commit comments