Customizing authentication e autorization, with constant for models names User, Permission, Group, PermissionMixin and constant for field names and table name

2023-02-15 Thread Jansen Magalhães
Dear, 

I would like to debate the possibility of updating Django regarding a 
better customization of the Auth app, with the possibility of customizing 
the models, field names, table names, through constants to be defined 
throughout the application for the actions of the models User, Permission, 
Group, PermissionMixin.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/645da71b-9926-410e-ac4e-3fcbcfc0b8dfn%40googlegroups.com.


Re: Customizing authentication e autorization, with constant for models names User, Permission, Group, PermissionMixin and constant for field names and table name

2023-02-15 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Hi Jansen,

I would like to see a more concrete and thought-out proposal, with the
motivation. For many problems you might encounter with the auth module,
there is a way to customize it. Beyond a certain point though, “reimplement
it yourself” is a reasonable solution. For example, if you need a different
database table name for Group, I’d say that would be grounds to implement
your own Group model - which really isn’t much code.

Thanks,

Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM1tC_DVQ16Lofv9Ca65Q5CygPr3BW%2BA7x7WGqLmMozCKg%40mail.gmail.com.


Re:

2023-02-15 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Please don’t email random code snippets to this list.

On Mon, Feb 13, 2023 at 3:29 PM Thomas Ménès 
wrote:

> def extra_permissions(permission_classes):
> """Decorate a CBV method to add specific permissions on the instance."""
> def decorator(func):
> def decorated_func(self, *args, **kwargs):
> for permission_class in permission_classes:
> # Check the extra view level permissions.
> permission = permission_class()
> if not permission.has_permission(self.request, self):
> self.permission_denied(
> self.request,
> message=getattr(permission, "message", None),
> code=getattr(permission, "code", None)
> )
> # Add them to permission classes for obj level checks.
> # Reassignment is for global tests as they call the same CBV intances.
> self.permission_classes = self.permission_classes + [permission_class]
> return func(self, *args, **kwargs)
> return decorated_func
> return decorator
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/08541759-4D69-4147-8009-0188C3CEED0D%40vingtcinq.io
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM2rZdzvgftnh320S4n5_ge9G4J-YRFkvd2ge3eRgUovww%40mail.gmail.com.


Re: I would like to participate and contribute in your project

2023-02-15 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Welcome Mohammed!

There are many different ways to contribute to Django - the forum,
blogging, translating, documenting, writing code, and more. Our
Contributing Guide can help you get started with many of these:
https://docs.djangoproject.com/en/stable/internals/contributing/

If you’re looking to work with the code base (for documentation or code),
check out the “Advice for New Contributors” section:
https://docs.djangoproject.com/en/stable/internals/contributing/new-contributors/
. Then see if you can work through the “Writing Your First Patch” tutorial:
https://docs.djangoproject.com/en/stable/intro/contributing/ .

If you get stuck or have questions, post back here or in the “Mentorship”
section on the forum:
https://forum.djangoproject.com/c/internals/mentorship/10

Hope that helps,

Adam

On Sun, Feb 12, 2023 at 10:15 PM Esteem Learning Centre, Abuja <
ahmeddauda.dr...@gmail.com> wrote:

> ok. you are welcome. Happy that you want to learn with us. What
> specifically u want to learn?
>
> On Sun, Feb 5, 2023, 8:05 PM Mohammed Shoaib  wrote:
>
>> Hi Mentors, I would like to contribute to your project. I'm a 1st year
>> Engineering student who is pursuing Electrical & Electronics in PSG College
>> of Technology. Please Suggest me some resources to learn the technologies
>> that you use as well as codebases. I'm a good learner. I'll spend more time
>> learning those.
>>
>>  Thank you
>>
>> with regards
>> Mohammed Shoaib S.T
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CAOeZ89g9%3D6ap4LYL6KXzDyJxxW4uT2ok_VyFhyKhTcC0Jsz7hw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAN0Tv2US2fJkb%3DM-PRdg53QfNnUGd%2B0%3D%3DAnCVCFt-xFLe0MD2g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3xoqKta3jEnSGmooBi8dwR5%2BEM1OpRq7jyVnM41b6h8Q%40mail.gmail.com.


Re: Customizing authentication e autorization, with constant for models names User, Permission, Group, PermissionMixin and constant for field names and table name

2023-02-15 Thread Jansen Magalhães
Hi Adam, 

Thanks for the feedback! 

I tried to leverage app auth framework to customize User, Permission, 
Group, PermissionMixin models. 

As for the User it works normally. There is the possibility to extend the 
models and place the db_table in the User Meta. There is also a constant 
AUTH_USER_MODEL to identify the CustomUser model that will be used for 
authentication. There are also the constant USERNAME_FIELD, EMAIL_FIELD to 
identify the model fields. 

The documentation also contains guidance on the AUTHENTICATION_BACKENDS 
constant to customize the authentication rules. 

I suggest the possibility of thinking about having similar constants for 
the Permission, Group, PermissionMixin models for a next update. 

For example, for the Pemisson model we can access it alternatively through 
an identification of a constant AUTH_PERMISSION_MODEL. The rest likewise 
AUTH_GROUP_MODEL, AUTH_USER_PERMISSIONS_MODEL, AUTH_USER_GROUPS_MODEL, 
AUTH_GROUP_PERMISSION_MODEL. 

It could also have the possibility of constants to identify the name of the 
fields in each of these models of the Auth app. For Permission would have: 
NAME, CODENAME. For Group it would have: NAME.

Respectfully,

Jansen

Em quarta-feira, 15 de fevereiro de 2023 às 14:06:20 UTC-3, Adam Johnson 
escreveu:

> Hi Jansen,
>
> I would like to see a more concrete and thought-out proposal, with the 
> motivation. For many problems you might encounter with the auth module, 
> there is a way to customize it. Beyond a certain point though, “reimplement 
> it yourself” is a reasonable solution. For example, if you need a different 
> database table name for Group, I’d say that would be grounds to implement 
> your own Group model - which really isn’t much code.
>
> Thanks,
>
> Adam
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/065862c1-8082-4217-aca8-96e2e379955fn%40googlegroups.com.