How to copy a group setting for further modification? - django

I am working on a Django website and I have extended the Django group model in admin page. Now when adding a new group, the user has to edit a list of settings. I am wondering if there is a way for user to select and copy a current group setting, then modify it into a new group. Does anyone have suggestions?

Related

G Suite: add users in child Organizational unit to Group automatically

When I add a new user to a child OU, how can I also add this user to the corresponding group automatically?
My scenario is that I have a Teachers child OU, when I add a new teacher, I also want to add the new teacher to the all_teachers group, so that:
we can send email to all_teachers.
all_teachers group is in the "classroom_teachers" group so that they can create a classroom.
What's the best way to achieve this? Thanks.
On a high level, you could do the following:
Fetch the users of the OU via the Admin Directory service.
Fetch the members of the group.
Compare the two and create an array of users' email address to be added.
Add the members to the group via the Admin Directory service.
There are some script samples that will help you get started at the Apps Script Reference's page on the Admin Directory advanced service.

Python scripting for using forms

I need to create groups on a server instance from its frontend. I need to do the following:
Login to the server
Check if the requested group already exists.
If it doesnot, then create a new group. For this I need to fill a form. group name will be provided by the requestor, the rest of the things will be selected from drop-down menu and all of them have a default value.
All this has to be done using python. I know how to connect to a server frontend. but i am not sure about checking the existence of the group name and how to select options from a drop-down
Use a database and store group names and when a user want to create a new group take the group and query the database if a group with that name already exist if yes send a message to the user that the group already exist else add new group and continue with other options,I don't know if this is what you want

Django staff user can't see any application

I have a group of user called "support". I want them to be able to log in the django admin site, view and modifiy the instances of the class "HelpContextual" of the application "support".
So I created a group "support" with the permission support | help contextual | Can change help contextual. The users can log in the django admin site, but they can't see any application.
I tried to give them all the permissions of the "support" application, but still, they can't see the support app. If I use a direct link to change a "help contextual" like this one : admin/support/helpcontextual/5/change/, I get a 403.
I feel like I'm missing something obvious... Can you point it to me ?
Make sure you have done the following steps.
Add group `Support.
Under available permissions select support | help contextual | Can change help contextual from Available Permissions and then make sure you have clicked on the arrow pointing to Change Permissions. This will move the specific permission to Change Permissions.
Click Save.
Create or open users.
Select Active and Staff Users.
Select Support from Available Groups and click the arrow pointing to Chosen Groups. This will move the Support group to Chosen Group.
Don't make any change to User Permissions unless you want to grant additional permissions to any specific user.
Click save.
Have the user logout and log back in.
Answered here https://stackoverflow.com/a/7021995/626748
I had a custom backend and removed the default django authentication backend...

Can I specify a set of Django user groups to be exclusive of each other?

I have a Django app that uses the stock User and Group models. I have two groups, group A and group B. I would like to prevent any user from being in both group A and group B, being in just one group or the other is fine. what is the best way to go about this? I was looking into model validation but I would like to do this without modifying or sub classing the stock User model. It would even be enough for me to be able to check and make sure that this wasnt being set on the django admin edit user page.

Django auth system: adding user to group via "invites"

I want to use the Django default auth system to manage users and groups. Is there an existing Django app/module that adds users to groups by invites? I.e. some existing user of the group sends an invite with a secret key in a URL, and another user that clicks on the URL joins the group.
I can write one, but figured I ask before doing that.
Thanks.
I am not sure if this will solve all your problems but do take a look at Pinax. They have features to support user invitation and user groups.