Skip to content
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

non login user for contact #10342

Open
gannebamm opened this issue Nov 23, 2022 · 6 comments
Open

non login user for contact #10342

gannebamm opened this issue Nov 23, 2022 · 6 comments
Labels
enhancement needs further investigation Issue or reason for specific behaviour needs further investigation

Comments

@gannebamm
Copy link
Contributor

Is your feature request related to a problem? Please describe.

As a research institute, we need to manage data given by third parties. Since we do not initially create the data, we want to set the originator/author contact to the third party. An example is data from the Federal Agency for Cartography and Geodesy (BKG) (https://gdz.bkg.bund.de/index.php/default/digitale-geodaten.html).

Describe the solution you'd like
As an admin, I want to create a Profile object which is not allowed to log in.

Describe alternatives you've considered

  • Use the current implemented Profile model for third parties:
    class Profile(AbstractUser):
    """Fully featured Geonode user"""

    These users, in theory, could log in/request a password reset by the email contact info given.
  • Create a completely new model for contacts. This new model would need to keep in sync with Profile and needs new UI elements to give information about the contact. This feels like overhead, seeing that we already have a proper Profile implementation which provides these features.

Additional context
See this #10290 as a reference for our implementation idea to set multiple contacts to one dataset. After that PR is finished, we will have the following ISO contact roles at hand:

author: party who authored the resource << THIRD PARTY ??
publisher: party who published the resource << THIRD PARTY ??
resource provider: party that supplies the resource << THIRD PARTY ??
originator: party who created the resource << THIRD PARTY ??
owner: party that owns the resource << IN THEORY THIRD PARTY, but this will mix up the user permissions! So keeping it on the resources owner in GeoNode (likely the admin) shall be used as a good enough workaround. See also #10290 (comment)

@gannebamm gannebamm added needs further investigation Issue or reason for specific behaviour needs further investigation enhancement labels Nov 23, 2022
@gannebamm
Copy link
Contributor Author

After doing some more digging into the abstract user from Django, maybe this is also ok:
https://docs.djangoproject.com/en/4.1/ref/contrib/auth/#django.contrib.auth.models.User.is_active

Defining a Profile as non-active should prevent it from logging in, I think?

@t-book
Copy link
Contributor

t-book commented Feb 16, 2023

@gannebamm yes if you remove the active check the user should not be able to login. Does this solve your issue?

image

@t-book
Copy link
Contributor

t-book commented Feb 16, 2023

(and maybe craete a group for those profiles to quickly identify them)

@giohappy
Copy link
Contributor

@gannebamm moreover, those users could be removed from the contributors (and registered-members if configured) Django Group.

image

@t-book
Copy link
Contributor

t-book commented Feb 16, 2023

Good point @giohappy Maybe even after every registration with some signal if the email does not end with the company domain...

from django.contrib.auth.models import User, Group
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.contrib.auth import get_user_model

@receiver(post_save, sender=get_user_model())
def remove_user_from_all_groups(sender, instance, created, **kwargs):
    if created and not instance.email.endswith("example.com"):
        groups = Group.objects.filter(user=instance)
        for group in groups:
            group.user_set.remove(instance)

@gannebamm
Copy link
Contributor Author

I have tested the ideas above. Those will not cover our use-case since you can not set a non active user as a contact. We will discuss options to resolve those requirements also with respect to #11511 and #12124.

@gannebamm gannebamm reopened this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs further investigation Issue or reason for specific behaviour needs further investigation
Projects
None yet
Development

No branches or pull requests

3 participants