diff --git a/abac/templates/base.html b/abac/templates/base.html new file mode 100644 index 0000000..79a6d1f --- /dev/null +++ b/abac/templates/base.html @@ -0,0 +1,57 @@ + + + + + + + + {% block title %}Privacy Preserving ABAC{% endblock %} + + + + + +
+ + {% if user.is_authenticated %} + + {% endif %} +
+ +
+
+ {% block content %}{% endblock %} +
+
+ + + + + + + + + + diff --git a/abac/templates/landing_page.html b/abac/templates/landing_page.html new file mode 100644 index 0000000..0ddc83d --- /dev/null +++ b/abac/templates/landing_page.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} + +{% block title %}Landing Page{% endblock %} + +{% block content %} +

All Files

+ +{% endblock %} \ No newline at end of file diff --git a/abac/templates/login.html b/abac/templates/login.html new file mode 100644 index 0000000..e2355d2 --- /dev/null +++ b/abac/templates/login.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} + +{% block title %}Login{% endblock %} + +{% block content %} +

Login

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/abac/urls.py b/abac/urls.py new file mode 100644 index 0000000..07f2287 --- /dev/null +++ b/abac/urls.py @@ -0,0 +1,11 @@ +# abac/urls.py + +from django.contrib.auth import views as auth_views +from django.urls import path + +from .views import landing_page + +urlpatterns = [ + path('login/', auth_views.LoginView.as_view(template_name='login.html'), name='login'), + path('', landing_page, name='home'), +] diff --git a/abac/views.py b/abac/views.py index 6c37995..658b9e0 100644 --- a/abac/views.py +++ b/abac/views.py @@ -3,7 +3,8 @@ from django.http.response import HttpResponseNotAllowed from django.contrib.auth.decorators import permission_required from django.http import HttpResponse -# Create your views here. +from .models import File + def create_user(request): special_user = request.user if special_user.has_perm('abac.can_create_users'): @@ -16,3 +17,8 @@ def create_user(request): def create_user_view(request): # Your view logic here return HttpResponse('New user created') + + +def landing_page(request): + files = File.objects.all() + return render(request, 'landing_page.html', {'files': files}) \ No newline at end of file diff --git a/mabac/settings.py b/mabac/settings.py index 1f38a3e..1c6686b 100644 --- a/mabac/settings.py +++ b/mabac/settings.py @@ -123,3 +123,6 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +LOGIN_REDIRECT_URL = '/' +LOGOUT_REDIRECT_URL = '/' diff --git a/mabac/urls.py b/mabac/urls.py index 85713d1..ab0de49 100644 --- a/mabac/urls.py +++ b/mabac/urls.py @@ -15,8 +15,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), + path('abac/', include('abac.urls')), ]