I have found lots of information on the internet about adding Members to a Group in Googlegroups, but I cant manage to get any of it to work.
I am working in Python-DJango.
Using a bussiness account, I manage to add them using Provisioning API, but I could not do it with the new Directory API.
The problem is the group I want to add people to is not a business one, it's an ordinary googlegroups one:
group_name#googlegroups.com
From what I have found, and what I did for the business group I have the following code:
groupClient = gdata.apps.groups.client.GroupsProvisioningClient(domain=domain)
groupClient.ClientLogin(email="user#gmail.com", password="xxx", source='apps')
groupClient.AddMemberToGroup("group_name#googlegroups.com", "newUser#gmail.com")
I wanted to know what I have to put in the domain field. With the business account it was the business domain, but being a normal googlegroups one I am not sure. I have tried googlegroups.com and doesn't work, as I always get a invalid domain error.
Any help would be appreciated
Thanks!
The Provisioning API (deprecated) and the new Admin SDK are both designed to work with Google Apps for Business and EDU and only work against Google Groups for Business (groups with a custom #yourdomain.com address).
You cannot use these APIs with consumer Google Groups that have #googlegroups.com email addresses. For these groups, your only option is to manage membership via the web interface.
Related
For audit purposes I'm trying to revoke/remove all blocked users from groups using a Python script. Until now I managed just to list all blocked users in my Gitlab instance using a simple curl:
curl -H "Private-Token: xxx” https://mygitlab.domain.com/api/v3/users?blocked=true. Can anyone point me to the right direction for a list with the groups, blocked users\group and how to revoke them using Gitlab API and Python. Any suggestion would be appreciated.
Thanks
I will give you a path to follow what you want, because stackoverflow is not a scripting service.
I don't how you are comfortable with scripting
Some tips to follow
List all groups
For each group, list all users
List all blocked users
Remove/Revoke every user of each group
This is the basic of your script, in this order
The next step is related the language that you want to use, in this case, python
I don't know if you know how to make http requests with python and, if not, read this article
https://rapidapi.com/blog/how-to-use-an-api-with-python/
This kind of audit is part of a larger effort followed by Epic 3155: "Provide an audit report of user permissions by group and project"
This is being implemented with, as a first step, GitLab 13.12 (May 2021)
Added total group and project count to admin users table
Previously, it was difficult to know how many groups and projects a user belonged to. Compliance-minded organizations, in particular, want to know which users have access to what systems or resources as part of their access management policy.
This information provides visibility into your users’ memberships to know if a user has too much access, may have leftover access from a change in their role or employment, or help you determine the scope of a user’s involvement in your company’s projects.
Now it’s easier to get a high-level view of your users’ memberships for auditing purposes.
In this iteration towards an exportable user access report we’ve added additional data to the admin panel for self-managed instances to show the total number of groups and projects a user belongs to.
See Documentation and Epic.
And:
See GitLab 13.12 (May 2021)
Users' group counts now displayed in Admin Area
The user list in the Admin Area now shows the total number of groups
a given user has access to. The group count is a sum of both group and subgroup membership.
This is incredibly valuable,
because you can easily see how much access users have and quickly
identify when action is needed.
For example, you might use this information
to ensure that deactivated accounts no longer have access to any projects or
groups in GitLab.
See Documentation and Epic.
My team are developing a payment system for our web services. The site is built using Django, with the payment services provided by stripe. We are using dj-stripe to integrate the two.
For development we are using the stripe test environment, but we are doing this on multiple development servers, each with it's own dev DB.
dj-stripe identifies which customer to associate payment, card and source activity with using the dj-stripe customer id. This causes a conflict in the information for customers with the same ids on different development severs.
We have thought of a number of workarounds for this, the top two choices are;
1) Generate an offset in the customer ids to prevent clash. The issue is this may break down as time goes on, with more developers joining. It fixes the issue for now, but doesn't guarantee it won't be an issue again.
2) Create a stripe account for each developer to ensure no clashes and only use the test environment. However, this seems like something stripe wouldn't be happy with if we end up with many devs working on the project.
I am interested in whether there is a standard solution or best practices for this issue.
In case anyone comes here for a similar issue, Stripe responded very quickly to our question on this. They already have a feature to deal with this, it just wasn't immediately obvious to us.
Stripe have a feature for you to add multiple accounts from your dashboard. You can simple create an account for each developer and just use the test keys for that account. Then invite all developers in your team to have read access to the account so that everyone can see the logs.
I was going through googles's api python-client-library and google analytics api . I was able to do all steps mentioned in official docs but then I got some doubts. Since I've never done this kind of thing before, so I need your valuable suggestions/tips.
My Goal:
Want to design a web application in Python(using django/flask) and google-api-python-client. I have few matrices(coming from my web ecommerce product that is using GA.) and I'm not sure if google analytics dashboard by default support at that deep level. so I will use Google's analytic api to customize data according to my need and show in my analytic web app(which can be accessed by any one).
Doubts/Queries:
1) first of all which reporting api I would be needing for this mentioned here. core api or metadata api?
2) while I was setting up the project and client key, I chose 2nd option(OAuth 2.0 client ID)
is that ok or should I chose service account? once I selected 2nd options there were couple of radio buttons(web, android, ios, other, etc.) I chose other or should I chose web?
3) once i chose other option from radio button list, I executed my script and it prompt a browser to ask for permission, I allowed. here my question is if I put my application on production would there not be any browser, what would happen in that case?
I would really appreciate if you can help me in these queries, sorry for long question, this is my first question.
PS: Bottom line is how one should structure and develop there analytic web application in general.
The key thing to understand is that Google Analytics is an authenticated API. It is designed make it easy to allow the end user to access their own data. It is designed to be hard to allow the end user to access data they do not own.
If you are building a web application to allow your users to access their own private data It is recommended that you use a client side authentication method, such as in this example or this example.
If you are trying to build a web application that shares your private data with your users there are a few ways to go about it:
You could collect the data server side in python using a service account (note you will have to add the service account the GA account you wish it to have access).
You can take a hybrid approach and have a service account generate an access token and use the embed api to actually make the query.
In the end I would encourage you to spend some time to read Using OAuth 2.0 to Access Google APIs, and understand senarios descussed and ask yourself which of these senerios will work best for my application.
I am using the Python Gdata API to manage Google Groups for my organization and am interested in using the "Disable Group" feature that is now available in the "New" Google Groups. Is this feature supported in the API?
I am using the methods listed on this page:
http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.apps.groups.service.html
I appreciate any help given.
Edited:
I don't think it is possible via Group Setting API.
The description for disabling a group is below:
"Once disabled all new posts to the group will be rejected. Old messages will be browseable and searchable online by anyone that has permission to view the group's content. If this setting is reverted, 'Who can post messages' will automatically be set to 'Managers only' in the 'Basic permissions' section."
I try to use the group setting API and change the setting from all in domain can post to just all manager can post to limit the posting of the group.
"whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST" -> ALL_MANAGERS_CAN_POST
Note if you take a look at the basic permission for a disabled group, it unchecked all the users who are allowed to post. However, the group setting APi only limit to you change to ALL manager can post.
So it didn't really disable a group...
Can you advice me with some articles/applications that allows you create SaaS(Software as a Service) application with Python and Django.
For the moment the general topics I do not understand are:
Do you have one working application for all clients or one app per client
How do you manage database access, permissions or different DB for each client
Are there any tools that allows you to convert one app to SaaS
one project, this will make maintenance easier. I handle host resolution with middleware in django-ikari.
you don't. see #1
I use the following :
django-ikari : anchored (sub)domains
django-guardian : per object permissions
django-tastypie : easy RESTful api
django-userprofiles : better than django-registration
django-billing : plan based subscription controls
django-pricing : plan based subscription definition
While not necessary, the following will help in the long run:
django-hunger : private beta signups
django-waffle : feature flip
django-classy-tags : nice, easy and neat templatetag creation
django-merchant : abstracted payment gateway framework
django-mockups : fast testing with models
django-merlin : better multi-step forms (wizards)
Finally, nice to have
django-activity-stream
A very basic, elementary example of how you would go about it.
Suppose you have a simple app designed to solve a particular business case. For example, you created an app to handle room reservations at your office.
To "convert" this app into a service you have to configure it such that most of the user-specific parts of the application are parametric (they can be "templatized" - for lack of better word).
This is how the front end would be converted. You might create variables to hold the logo, headline, teaser, color scheme for the app; allowing each user to customize their instance.
So far, your app is able to customize itself on the front end. It is still using the same database that was designed in phase one.
Now comes the matter of showing only those fields that are relevant to a particular user. This would be parameterizing the database. So you might add a column that identifies each row as belonging to a particular user; then create views or stored procedures that filter records based on the logged in user.
Now the application is able to be "rented" out; since you are able to customize the instance based on the user.
It then just gets bigger from here - depending on the scale, type and intended customization of your application. You might decide that your application performs better when each user has their own dedicated database instead of the stored procedure + view combo.
You may decide that for some user types (or "packages"), you need a dedicated instance of your application running. So for "premium" or "ultra" users you want to have their own dedicated system running.
If your application requires lots of storage - you might decide to charge separately for storage.
The bottom line is it has nothing to do with the language used. Its more an architecture and design problem.
Software as a Service is just a marketing word, it's technically no different from a server that is accessible over the internet. So question 3 makes no sense. That leaves us with question 1 and 2:
What do you mean with 'app' in this context? Your web application (built with Python and Django) can have multiple Django apps (components that make up the web application) but I think that's not what you mean. You can build your website in Python/Django and have various customization options depending on which user (client) is logged in. For example, a premium client can have several advanced options enabled but it's still part of the same codebase. It's just that some options (buttons/controls, etc) are not shown for certain clients
Django has plenty of tools for user management, permissions and groups. You can give each user (each client) different permissions and these permissions determine what they can do. Database access should be managed by your web application. For example, the code determines what information needs to be displayed on the webpage (depending on which client is logged in) and that code retrieves the information from the database. Depending on the scale that you're aiming for, you can also specify which database should be used to retrieve the information from.
I have a blog post describing my proposal of how to go about making a multi tenant SAAS web application using Django. Multi-tenancy here means that when user registers, they have their sub-domain. To recap:
All tenants share one database, but each has their own schemas. Imagine you have website abc.com and someone registered a xyz tenant so that they access their page through xyz.abc.com, then for a tenant xyz you have a separate schema containing all the tables thus encapsulating data related only to xyz tenant. There are other ways, like having one database and one schema for all, or having even separate databases. But schemas approach is the best trade-off. The django-tenants library's documentation contains more detailed info if you are interested
Use django-tenants library to abstract away work with tenants. When someone accesses xyz.abc.com, you need to know that xyz is the tenant and that you should use xyz schema. django-tenants library does this for you so on each request you can obtain the tenant object by simply doing current_tenant = request.tenant
You need to differentiate between shared tables and tenant-specific tables. For example, having table with list of orders is tenant-specific. Every tenant might have their own database containing all their orders. This table should be inside xyz schema. At the same time, you will have some core Django tables, like user. The data can be shared, for example, to disallow two users registering with the same email.
You need to configure your DNS to catch a wildcard expression *.abc.com, for which you can add an A record inside your CPanel with *.abc.com linking to the IP of your server