-
Notifications
You must be signed in to change notification settings - Fork 45
POC: Use Django authentication system with NAV's Account
model
#3493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lunkwill42
wants to merge
12
commits into
master
Choose a base branch
from
poc/django-auth
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dd8288e
Add `is_active` implementation to Account
lunkwill42 0713103
Implement natural key system for Account
lunkwill42 de081ed
Add auth and contenttypes to installed Django apps
lunkwill42 12d968e
Use Django authentication in `do_login`
lunkwill42 d233f83
Explicitly set app_label for nav.models
hmpf 0bcf4cb
Use Django's ModelBackend for auth
hmpf adc3ba4
Use is_anonymous instead of is_default_account
hmpf fe13afe
Use correct AnonymousUser
hmpf 3886104
Make tables Django wants for auth
hmpf e702cbc
Set up sudoing in the new auth middleware
hmpf 59bcb0b
Move old account utils to nav.web.auth.utils
hmpf 6d59681
Replace auth middleware in modpython
hmpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
|
||
class NavModelsConfig(AppConfig): | ||
name = 'nav.models' | ||
label = 'nav_models' | ||
verbose_name = 'NAV models' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- Create models needed for Django auth | ||
|
||
BEGIN; | ||
|
||
-- | ||
-- Create model ContentType | ||
-- | ||
CREATE TABLE "profiles"."django_content_type" ("id" integer NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "app_label" varchar(100) NOT NULL, "model" varchar(100) NOT NULL); | ||
-- | ||
-- Alter unique_together for contenttype (1 constraint(s)) | ||
-- | ||
ALTER TABLE "profiles"."django_content_type" ADD CONSTRAINT "django_content_type_app_label_model_76bd3d3b_uniq" UNIQUE ("app_label", "model"); | ||
|
||
-- | ||
-- Create model Permission | ||
-- | ||
CREATE TABLE "profiles"."auth_permission" ("id" integer NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "name" varchar(255) NOT NULL, "content_type_id" integer NOT NULL, "codename" varchar(100) NOT NULL); | ||
COMMIT; | ||
|
||
-- | ||
-- Create model Group | ||
-- | ||
CREATE TABLE "profiles"."auth_group" ("id" integer NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "name" varchar(150) NOT NULL UNIQUE); | ||
CREATE TABLE "profiles"."auth_group_permissions" ("id" integer NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "group_id" integer NOT NULL, "permission_id" integer NOT NULL); | ||
|
||
-- Set up constraints, indexes; add foreign keys | ||
|
||
ALTER TABLE "profiles"."auth_permission" ADD CONSTRAINT "auth_permission_content_type_id_codename_01ab375a_uniq" UNIQUE ("content_type_id", "codename"); | ||
ALTER TABLE "profiles"."auth_permission" ADD CONSTRAINT "auth_permission_content_type_id_2f476e4b_fk_django_co" FOREIGN KEY ("content_type_id") REFERENCES "profiles"."django_content_type" ("id") DEFERRABLE INITIALLY DEFERRED; | ||
CREATE INDEX "auth_permission_content_type_id_2f476e4b" ON "profiles"."auth_permission" ("content_type_id"); | ||
CREATE INDEX "auth_group_name_a6ea08ec_like" ON "profiles"."auth_group" ("name" varchar_pattern_ops); | ||
ALTER TABLE "profiles"."auth_group_permissions" ADD CONSTRAINT "auth_group_permissions_group_id_permission_id_0cd325b0_uniq" UNIQUE ("group_id", "permission_id"); | ||
ALTER TABLE "profiles"."auth_group_permissions" ADD CONSTRAINT "auth_group_permissions_group_id_b120cbf9_fk_auth_group_id" FOREIGN KEY ("group_id") REFERENCES "profiles"."auth_group" ("id") DEFERRABLE INITIALLY DEFERRED; | ||
ALTER TABLE "profiles"."auth_group_permissions" ADD CONSTRAINT "auth_group_permissio_permission_id_84c5c92e_fk_auth_perm" FOREIGN KEY ("permission_id") REFERENCES "profiles"."auth_permission" ("id") DEFERRABLE INITIALLY DEFERRED; | ||
CREATE INDEX "auth_group_permissions_group_id_b120cbf9" ON "profiles"."auth_group_permissions" ("group_id"); | ||
CREATE INDEX "auth_group_permissions_permission_id_84c5c92e" ON "profiles"."auth_group_permissions" ("permission_id"); | ||
|
||
COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably switch places