Skip to content

Commit

Permalink
Merge pull request #50 from SELab-2/permissions
Browse files Browse the repository at this point in the history
Initialized permissions logic
  • Loading branch information
EwoutV authored Mar 5, 2024
2 parents 89cdb0b + fe100d8 commit 0c4d10e
Show file tree
Hide file tree
Showing 28 changed files with 298 additions and 562 deletions.
301 changes: 58 additions & 243 deletions backend/api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-02-28 21:55
# Generated by Django 5.0.2 on 2024-03-05 14:25

import datetime
import django.db.models.deletion
Expand All @@ -7,300 +7,115 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
("authentication", "0001_initial"),
('authentication', '0001_initial'),
]

operations = [
migrations.CreateModel(
name="Admin",
fields=[
(
"user_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"abstract": False,
},
bases=("authentication.user",),
),
migrations.CreateModel(
name="FileExtension",
name='FileExtension',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("extension", models.CharField(max_length=10, unique=True)),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extension', models.CharField(max_length=10, unique=True)),
],
),
migrations.CreateModel(
name="Course",
name='Course',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100)),
("academic_startyear", models.IntegerField()),
("description", models.TextField(blank=True, null=True)),
(
"parent_course",
models.OneToOneField(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="child_course",
to="api.course",
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('academic_startyear', models.IntegerField()),
('description', models.TextField(blank=True, null=True)),
('parent_course', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='child_course', to='api.course')),
],
),
migrations.CreateModel(
name="Assistant",
name='Assistant',
fields=[
(
"user_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
(
"courses",
models.ManyToManyField(
blank=True, related_name="assistants", to="api.course"
),
),
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('courses', models.ManyToManyField(blank=True, related_name='assistants', to='api.course')),
],
options={
"abstract": False,
'abstract': False,
},
bases=("authentication.user",),
bases=('authentication.user',),
),
migrations.CreateModel(
name="Checks",
name='Checks',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("dockerfile", models.FileField(blank=True, null=True, upload_to="")),
(
"allowed_file_extensions",
models.ManyToManyField(
blank=True,
related_name="checks_allowed",
to="api.fileextension",
),
),
(
"forbidden_file_extensions",
models.ManyToManyField(
blank=True,
related_name="checks_forbidden",
to="api.fileextension",
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dockerfile', models.FileField(blank=True, null=True, upload_to='')),
('allowed_file_extensions', models.ManyToManyField(blank=True, related_name='checks_allowed', to='api.fileextension')),
('forbidden_file_extensions', models.ManyToManyField(blank=True, related_name='checks_forbidden', to='api.fileextension')),
],
),
migrations.CreateModel(
name="Project",
name='Project',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100)),
("description", models.TextField(blank=True, null=True)),
("visible", models.BooleanField(default=True)),
("archived", models.BooleanField(default=False)),
(
"start_date",
models.DateTimeField(blank=True, default=datetime.datetime.now),
),
("deadline", models.DateTimeField()),
(
"checks",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="api.checks",
),
),
(
"course",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="projects",
to="api.course",
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('description', models.TextField(blank=True, null=True)),
('visible', models.BooleanField(default=True)),
('archived', models.BooleanField(default=False)),
('start_date', models.DateTimeField(blank=True, default=datetime.datetime.now)),
('deadline', models.DateTimeField()),
('checks', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.checks')),
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='api.course')),
],
),
migrations.CreateModel(
name="Student",
name='Student',
fields=[
(
"user_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
("student_id", models.CharField(max_length=8, null=True, unique=True)),
(
"courses",
models.ManyToManyField(
blank=True, related_name="students", to="api.course"
),
),
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('student_id', models.CharField(max_length=8, null=True, unique=True)),
('courses', models.ManyToManyField(blank=True, related_name='students', to='api.course')),
],
options={
"abstract": False,
'abstract': False,
},
bases=("authentication.user",),
bases=('authentication.user',),
),
migrations.CreateModel(
name="Group",
name='Group',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("score", models.FloatField(blank=True, null=True)),
(
"project",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="groups",
to="api.project",
),
),
(
"students",
models.ManyToManyField(related_name="groups", to="api.student"),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('score', models.FloatField(blank=True, null=True)),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='groups', to='api.project')),
('students', models.ManyToManyField(related_name='groups', to='api.student')),
],
),
migrations.CreateModel(
name="Submission",
name='Submission',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("submission_number", models.PositiveIntegerField()),
("submission_time", models.DateTimeField(auto_now_add=True)),
(
"group",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="submissions",
to="api.group",
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('submission_number', models.PositiveIntegerField()),
('submission_time', models.DateTimeField(auto_now_add=True)),
('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to='api.group')),
],
options={
"unique_together": {("group", "submission_number")},
'unique_together': {('group', 'submission_number')},
},
),
migrations.CreateModel(
name="SubmissionFile",
name='SubmissionFile',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("file", models.FileField(upload_to="")),
(
"submission",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="files",
to="api.submission",
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', models.FileField(upload_to='')),
('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='api.submission')),
],
),
migrations.CreateModel(
name="Teacher",
name='Teacher',
fields=[
(
"user_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
(
"courses",
models.ManyToManyField(
blank=True, related_name="teachers", to="api.course"
),
),
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('courses', models.ManyToManyField(blank=True, related_name='teachers', to='api.course')),
],
options={
"abstract": False,
'abstract': False,
},
bases=("authentication.user",),
bases=('authentication.user',),
),
]
10 changes: 0 additions & 10 deletions backend/api/models/admin.py

This file was deleted.

20 changes: 0 additions & 20 deletions backend/api/serializers/admin_serializer.py

This file was deleted.

Loading

0 comments on commit 0c4d10e

Please sign in to comment.