Commit 9363d5c5 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added tracking user auth mdoe.

parent d1280df4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ class RosettaOIDCAuthenticationBackend(OIDCAuthenticationBackend):
        user = super(RosettaOIDCAuthenticationBackend, self).create_user(claims)

        # Add profile, keys etc.
        finalize_user_creation(user)
        finalize_user_creation(user, auth='oidc')

        return user

+3 −3
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class Command(BaseCommand):
            testuser.is_superuser=True
            testuser.save() 
            print('Creating testuser profile')
            Profile.objects.create(user=testuser, authtoken='129aac94-284a-4476-953c-ffa4349b4a50')
            Profile.objects.create(user=testuser, auth='local', authtoken='129aac94-284a-4476-953c-ffa4349b4a50')

            # Create default keys
            print('Creating testuser default keys')
@@ -82,8 +82,8 @@ class Command(BaseCommand):
                <br/><br/>
                A test user with admin rights registered with email <code>testuser@rosetta.platform</code> and password 
                <code>testpass</code> has been created as well, which you can use to login on the menu on the right and give Rosetta
                immediately a try. If you run with the default docker-compose file (i.e. you just run <code>rosetta/setup</code>),
                then you will also have a few demo computing and storage resources (beside the internal engine) already available
                immediately a try. If you are using the default docker-compose file (i.e. you just ran <code>rosetta/setup</code>),
                then you will also have a few demo computing and storage resources (beside the internal one) already available
                and that you can play with, including a small Slurm cluster. Otherwise, you will need to setup your own ones
                from the <a href="/admin">admin</a> section.
                <br />
+19 −0
Original line number Diff line number Diff line
# Generated by Django 2.2.1 on 2021-11-15 17:51

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('core_app', '0019_auto_20211115_1547'),
    ]

    operations = [
        migrations.AddField(
            model_name='profile',
            name='auth',
            field=models.CharField(default='oidc', max_length=36, verbose_name='User auth mode'),
            preserve_default=False,
        ),
    ]
+2 −1
Original line number Diff line number Diff line
@@ -43,8 +43,9 @@ class Profile(models.Model):

    uuid      = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    user      = models.OneToOneField(User, on_delete=models.CASCADE)
    auth      = models.CharField('User auth mode', max_length=36)
    timezone  = models.CharField('User Timezone', max_length=36, default='UTC')
    authtoken = models.CharField('User auth token', max_length=36, blank=True, null=True)
    authtoken = models.CharField('User auth token', max_length=36, blank=True, null=True) # This is used for testing, not a login token.
    is_power_user = models.BooleanField('Power user status', default=False)
    extra_confs   = JSONField(blank=True, null=True)

+26 −6
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

       <tr>
        <td>
        <b>Account ID</b>
        <b>ID</b>
        </td>
        <td>
        {{data.user.username}}
@@ -28,7 +28,7 @@
      
       <tr>
        <td>
        <b>Account email</b>
        <b>Email</b>
        </td>
        <td>
        {% if data.edit == 'email' %}    
@@ -39,14 +39,15 @@
          <input type="submit" value="Go">
          </td></tr></table>          
        {% else %}
         {{data.user.email}} | <a href="/account/?edit=email">Change</a>
         {{data.user.email}}{% if data.user.profile.auth == 'local' %} | <a href="/account/?edit=email">Change</a>{% endif %}
        {% endif %}
        </td>
       </tr>      

       {% if data.user.profile.auth == 'local' %}
       <tr>
        <td>
        <b>Account password</b>
        <b>Password</b>
        </td>
        <td>
        {% if data.edit == 'password' %}    
@@ -61,6 +62,25 @@
        {% endif %}
        </td>
       </tr>
       {% endif %}  


       <tr>
        <td>
        <b>Auth</b>
        </td>
        <td>
        {% if data.user.profile.auth == 'local' %}
        Local
        {% elif data.user.profile.auth == 'oidc' %}
        Open ID Connect
        {% else %}
        {{ data.user.profile.auth }}
        {% endif %}
        </td>    
       </tr>



      </table>
      <br />
@@ -129,7 +149,7 @@
      </form>
      
      <div style="margin-left:10px; margin-top:40px">
        {% if OPENID_ENABLED %}
        {% if data.user.profile.auth == 'oidc' %}
        <form action="{% url 'oidc_logout' %}" method="post">
        {% csrf_token %}
        <input type="submit" value="logout">
Loading