-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from OpenGeoscience/auth-and-projects
Authentication and projects
- Loading branch information
Showing
59 changed files
with
1,259 additions
and
407 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
File renamed without changes.
File renamed without changes.
This file contains 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 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 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 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 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 @@ | ||
import os | ||
|
||
from django.contrib.sites.models import Site | ||
from django.core.management.base import BaseCommand, CommandError | ||
from oauth2_provider.models import Application | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Creates a client Application object for authentication purposes.' | ||
|
||
def handle(self, **kwargs): | ||
uri = os.environ.get('VUE_APP_BASE_URL') | ||
client_id = os.environ.get('VUE_APP_OAUTH_CLIENT_ID') | ||
if uri is None: | ||
raise CommandError('Environment variable VUE_APP_BASE_URL is not set.') | ||
if client_id is None: | ||
raise CommandError('Environment variable VUE_APP_OAUTH_CLIENT_ID is not set.') | ||
|
||
site = Site.objects.get_current() # type: ignore | ||
site.domain = 'uvdat.demo' | ||
site.name = 'UVDAT' | ||
site.save() | ||
|
||
_, created = Application.objects.get_or_create( | ||
name='client-app', | ||
defaults={ | ||
'redirect_uris': uri, | ||
'client_id': client_id, | ||
'client_type': 'public', | ||
'authorization_grant_type': 'authorization-code', | ||
'skip_authorization': True, | ||
}, | ||
) | ||
if not created: | ||
raise CommandError( | ||
'The client already exists. You can administer it from the admin console.' | ||
) | ||
self.stdout.write(self.style.SUCCESS('Client Application created.')) |
This file contains 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,80 @@ | ||
# Generated by Django 5.0.7 on 2024-09-29 16:44 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0004_files_and_networks'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name='Context', | ||
new_name='Project', | ||
), | ||
migrations.AlterModelOptions( | ||
name='project', | ||
options={ | ||
'permissions': [ | ||
('owner', 'Can read, write, and delete'), | ||
('collaborator', 'Can read and write'), | ||
('follower', 'Can read'), | ||
] | ||
}, | ||
), | ||
migrations.RemoveConstraint( | ||
model_name='derivedregion', | ||
name='unique-derived-region-name', | ||
), | ||
migrations.RemoveField( | ||
model_name='chart', | ||
name='context', | ||
), | ||
migrations.RemoveField( | ||
model_name='derivedregion', | ||
name='context', | ||
), | ||
migrations.RemoveField( | ||
model_name='simulationresult', | ||
name='context', | ||
), | ||
migrations.AddField( | ||
model_name='chart', | ||
name='project', | ||
field=models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name='charts', | ||
to='core.project', | ||
), | ||
), | ||
migrations.AddField( | ||
model_name='derivedregion', | ||
name='project', | ||
field=models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name='derived_regions', | ||
to='core.project', | ||
), | ||
), | ||
migrations.AddField( | ||
model_name='simulationresult', | ||
name='project', | ||
field=models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name='simulation_results', | ||
to='core.project', | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name='derivedregion', | ||
constraint=models.UniqueConstraint( | ||
fields=('project', 'name'), name='unique-derived-region-name' | ||
), | ||
), | ||
] |
This file contains 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 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 was deleted.
Oops, something went wrong.
This file contains 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.