Redmine API Users in Groups - redmine

I am Making a wpf app that shows some data from redmine using Redmine.Net.Api.
I just want to display users that belong to redmine Groups.
I can get all groups
Redminemanager manager = new RedmineManager(Config.host, Config.apiKey);
var groups = manager.GetObjects<Group>();
I get groups names right, but the users are always Null.
I tried too the Groups under User class:
Redminemanager manager = new RedmineManager(Config.host, Config.apiKey);
var redmineUsers = manager.GetObjects<User>()
Groups there are always null too.
I don't get this, I hope someone can help.
Thanks in advance.

It's about how the Redmine REST API works: by default, listing a group WONT retrieve the users.
The Redmine REST API documentation, GET Groups section, says:
GET
Returns details of a group.
This endpoint requires admin privileges.
Parameters:
include (optional): a coma separated list of associations to include in the response:
users
memberships
I tried a GET /groups/1.json on my local Redmine installation without the include=users and actually doesn't retrieve the users. When I add the ?include=users it works like a charm
On the official Redmine.Net.API Wiki on Github there is an example using these include parameters.
It's something like this:
var group = manager.GetObject<Group>(groupId,
new NameValueCollection() { { RedmineKeys.INCLUDE, RedmineKeys.USERS } });
Good luck.

Related

Find all Google Groups with members with emails from a specific domain

My org uses Google Groups for Drive and site access for external parties. I need to make sure that all members from a specific domain are removed from all the groups they may be in.
I've tried finding an appropriate report or audit in Workspace Admin but I can't find one that would give a complete picture.
I'm sure there's a way to do this through the API but I'm not a developer and my ability to interact with it is limited to the little example operations they give you on the SDK page.
Even if I could just get an exhaustive list of all members and their groups, I could complete this task. Add-ons would be a nice tool if there are any quality, trusted group manager add-ons out there.
I created the following sample script using Google Apps Script that accomplishes what you are looking for. All you need is to change the domain variable so that it contains the domain of the users that you want to delete.
What the script does is to get the list of users from all the groups, then compares which users have the specified domain in their email address and removes them from the group.
Here is the code:
function removeExternals()
{
let domain = "domain.com";
let groups;
let users;
let externalUsers = [];
groups = AdminDirectory.Groups.list({"customer": "my_customer"});
let groupsIds = [groups.groups.length];
for(let i=0; i< groups.groups.length; i++)
{
groupsIds[i] = groups.groups[i].id;
users = AdminDirectory.Members.list(groupsIds[i]);
for(let x=0; x< groups.groups[i].directMembersCount;x++)
{
try
{
if(users.members[x].email.search(domain)!=-1)
{
//externalUsers.push(users.members[x].email);
AdminDirectory.Members.remove(groupsIds[i], users.members[x].email);
Logger.log(`Deleted: ${users.members[x].email}`);
}
}
catch{};
}
}
}
To test it out you can just create a project in Google Apps Script, paste the code there and change the domain variable (make sure at least one user with that domain is part of a group). You also need to add the Admin SDK API service to Google Apps Script first by clicking Services then click Admin SDK API and then click Add.
References:
groups.list
members.delete

How to fetch a list of Facebook groups that a user administers after new API changes?

Our app has been approved for Groups API as well as publish_to_groups API.
Earlier, Facebook let you get groups that a given user administered. However, administer field is deprecated in the latest API.
How can we fetch it now?
I finally found how to do it. Earlier, Facebook allowed you to pass a filter with ?administrator=1 GET parameter. However, they still have an undocumented field administrator that you can fetch via ?field=administrator GET parameter. It will let you know if you are an admin or not and you can use it from there.

Google groups API for non GSuite accounts? [duplicate]

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.

How can I add users to a Facebook group automatically?

The flow I'm going for is:
User signs in with Facebook to our site.
User pays a fee using PayPal or some similar service.
User is allowed access to a particular Facebook group.
I'm not particularly fussy about how the process works, but I'd like to avoid a manual step if possible.
I know I can't invite them using the Graph API (as they're not an admin, developer or tester of the app). But is there some other way round? A button that allows them to request access that I then confirm using the API? An automatic way of emailing an invite?
Or is there a way of making it easier to do the manual step? Some way of listing the new users with an "invite to group" button? A friend request button for the user to press?
With facebook API you can't do this with a normal group, but you can use app groups instead. To create an app group, you have to do a POST request to this url:
http://graph.facebook.com/{your-app-id}/groups
with the following informations:
valid app access token
name: the name of the group
description: the description of the group
privacy: enum, it can be open or closed
admin: admin's user id
Then you will recive a gropu ID. You can get info about your group ith a GET request to this URL:
http://graph.facebook.com/{group-id}
EDITED: You can no longer add members with POST request, but there is an another way.
New solution
You can use a client-side dialog to add members to groups. You can find the documentation here: https://developers.facebook.com/docs/games/app-game-groups/v2.0#add_user
I tested it with a user who wasn't a tester, andd it works fine.
Old solution (no longer available)
You can add members to this group with a POST request to this URL:
http://graph.facebook.com/{group-id}/members
You have to post:
valid app access token
member: user ID of the person to invite
The person will recive something like this image:
(source: edemmester.hu)
I tested it, it works fine.
More info about app groups: https://developers.facebook.com/docs/graph-api/reference/v2.0/app/groups
IMPORTANT! You have to use app access tokens here, not user access tokens.
I don't think it's possible to invite people without writing a browser extension that has access to the cookies etc. of the logged-in group admin.
Anyway, you cannot simply add people to a group if you're not friends with them, but need to invite them by email. So probably it's easiest if you ask them for their email-address and then invite them by email.

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.