mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-16 02:10:19 -04:00
working on user permissions
This commit is contained in:
parent
591af545ef
commit
672cd47852
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -246,6 +246,9 @@ Control.ca-bundle
|
||||||
Control.system-ca-bundle
|
Control.system-ca-bundle
|
||||||
GitHub.sublime-settings
|
GitHub.sublime-settings
|
||||||
|
|
||||||
|
#SkoolOS
|
||||||
|
*.profile
|
||||||
|
|
||||||
# Visual Studio Code #
|
# Visual Studio Code #
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{'id': 1000417, 'ion_username': '2023rumareti', 'sex': 'Male', 'title': None, 'display_name': 'Rushil Umaretiya', 'full_name': 'Rushil Umaretiya', 'short_name': 'Rushil', 'first_name': 'Rushil', 'middle_name': 'Haresh', 'last_name': 'Umaretiya', 'nickname': None, 'tj_email': '2023rumareti@tjhsst.edu', 'emails': ['rushilwiz@gmail.com', 'r@crucialnet.org'], 'grade': {'number': 9, 'name': 'freshman'}, 'graduation_year': 2023, 'user_type': 'student', 'phones': ['Mobile Phone: 7034570803'], 'websites': ['http://crucialnet.org'], 'counselor': {'id': 115, 'url': 'https://ion.tjhsst.edu/api/profile/115', 'user_type': 'counselor', 'username': 'kchamblin', 'full_name': 'Kerry Hamblin', 'first_name': 'Kerry', 'last_name': 'Hamblin'}, 'address': None, 'picture': 'https://ion.tjhsst.edu/api/profile/1000417/picture', 'is_eighth_admin': False, 'is_announcements_admin': False, 'is_teacher': False, 'is_student': True, 'absences': 1}
|
|
@ -14,7 +14,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="d-flex align-items-center justify-content-center" style="height: 100vh">
|
<div class="d-flex align-items-center justify-content-center" style="height: 100vh">
|
||||||
<a href="https://ion.tjhsst.edu/oauth/authorize/?response_type=code&client_id=QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=read&state=81xYFv6S9CLi7laXQ64gJWskDJUMMb" title="Ion" class="border border-dark p-3 btn btn-lg mx-auto" style="box-shadow: 5px 10px;">
|
<a href="https://ion.tjhsst.edu/oauth/authorize/?response_type=code&client_id=QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fcallback%2F&scope=read&state=FLGmyyTMqIjqb60NU6OCnA9hWhFlIO" title="Ion" class="border border-dark p-3 btn btn-lg mx-auto" style="box-shadow: 5px 10px;">
|
||||||
<img src="https://ion.tjhsst.edu/static/img/favicon.png">
|
<img src="https://ion.tjhsst.edu/static/img/favicon.png">
|
||||||
Sign in with Ion
|
Sign in with Ion
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import (
|
||||||
|
DefFiles,
|
||||||
|
Assignment,
|
||||||
|
Classes,
|
||||||
|
Teacher,
|
||||||
|
Student
|
||||||
|
)
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
admin.site.register(Teacher)
|
||||||
|
admin.site.register(Student)
|
||||||
|
admin.site.register(DefFiles)
|
||||||
|
admin.site.register(Assignment)
|
||||||
|
admin.site.register(Classes)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
class DefFiles(models.Model):
|
class DefFiles(models.Model):
|
||||||
name=models.CharField(max_length=100)
|
name=models.CharField(max_length=100)
|
||||||
|
@ -21,7 +22,7 @@ class Assignment(models.Model):
|
||||||
return '%s' % (self.name)
|
return '%s' % (self.name)
|
||||||
|
|
||||||
class Classes(models.Model):
|
class Classes(models.Model):
|
||||||
owner = models.ForeignKey('auth.User', related_name='classes', on_delete=models.CASCADE)
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
name = models.CharField(primary_key=True, max_length=100)
|
name = models.CharField(primary_key=True, max_length=100)
|
||||||
repo=models.URLField(default="", blank=True)
|
repo=models.URLField(default="", blank=True)
|
||||||
|
@ -50,14 +51,8 @@ class Teacher(models.Model):
|
||||||
email=models.CharField(max_length=100, default="", blank=True)
|
email=models.CharField(max_length=100, default="", blank=True)
|
||||||
|
|
||||||
class Student(models.Model):
|
class Student(models.Model):
|
||||||
owner = models.ForeignKey('auth.User', related_name='students', on_delete=models.CASCADE)
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
|
||||||
first_name = models.CharField(max_length=100)
|
|
||||||
last_name = models.CharField(max_length=100)
|
|
||||||
student_id = models.IntegerField()
|
student_id = models.IntegerField()
|
||||||
ion_user=models.CharField(primary_key=True, max_length=100)
|
|
||||||
email=models.CharField(max_length=100, default="", blank=True)
|
|
||||||
grade = models.IntegerField()
|
grade = models.IntegerField()
|
||||||
git=models.CharField(max_length=100)
|
git=models.CharField(max_length=100)
|
||||||
repo=models.URLField(default="", blank=True)
|
repo=models.URLField(default="", blank=True)
|
||||||
|
|
8
Website/api/signals.py
Normal file
8
Website/api/signals.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.db.models.signals import post_save
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from .models import Student, Teacher
|
||||||
|
|
||||||
|
@receiver(post_save, sender=User)
|
||||||
|
def save_profile(sender, instance, **kwargs):
|
||||||
|
instance.profile.save()
|
|
@ -7,6 +7,8 @@ from requests_oauthlib import OAuth2Session
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
|
||||||
from .models import Token
|
from .models import Token
|
||||||
|
from api.models import Student, Teacher
|
||||||
|
|
||||||
from .forms import UserCreationForm
|
from .forms import UserCreationForm
|
||||||
|
|
||||||
from django.contrib.auth import authenticate
|
from django.contrib.auth import authenticate
|
||||||
|
@ -125,5 +127,5 @@ def create_account (request):
|
||||||
@login_required
|
@login_required
|
||||||
def logout(request):
|
def logout(request):
|
||||||
auth_logout(request)
|
auth_logout(request)
|
||||||
messages.success(request, "You've been logged out! Have a good rest of your day!")
|
messages.success(request, "You've been logged out!")
|
||||||
return redirect(request, "/login/")
|
return redirect(request, "/login/")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user