Adding Community Members to a community activity using the REST API gives 403 - api

We want to add community members (as author) to a community activity.
We see that both on prem and in Connections Cloud, that we get a 403 error.
I have reproduced this using the SBT playground (https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/Explorer.xsp#)
This is the XML that we post:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<id>test1234</id>
<contributor>
<name>Test User/name>
<snx:userid>TestID</snx:userid>
<snx:role>member</snx:role>
<snx:userState>active</snx:userState>
</contributor>
<title>Test User</title>
<updated>2016-03-04T09:25:17Z</updated>
<summary type="text">Member profile for Test User</summary>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="person"> </category>
<snx:role component="http://www.ibm.com/xmlns/prod/sn/activities">member</snx:role>
</entry>
To the Endpoint for activities: https://apps.na.collabserv.com/activities/service/atom2/acl?activityUuid=a750558c-d555-474d-8fcf-c3577276e9af
When we work "on-prem" we don't get error when we add community owners to the activity. Only when we (try to) add community members this 403 error occurs.
When we perform the action through the UI, there are no issues

We finaly have managed to add community members (not owners) to community_activity programmatically in IBM Connections.
When creating a community activity, Ibm Connections adds groups (as role) to community activities. If you want to add a specific member to your activity as an editor/reader, then you have to tell IBM Connections what role you want to give the other members from the group.

Can you try with below api and I am also attaching sample body you should be posting.
API : https://apps.na.collabserv.com/communities/service/atom/community/members?communityUuid=
Body
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<contributor>
<email>mkataria#in.ibm.com</email>
<snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">202432348</snx:userid>
<snx:userState xmlns:snx="http://www.ibm.com/xmlns/prod/sn">active</snx:userState>
<snx:isExternal xmlns:snx="http://www.ibm.com/xmlns/prod/sn">false</snx:isExternal>
<name>Manish Kataria</name>
</contributor>
<snx:role xmlns:snx="http://www.ibm.com/xmlns/prod/sn" component="http://www.ibm.com/xmlns/prod/sn/communities">owner</snx:role>
<category term="person" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="business-owner" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<snx:orgId xmlns:snx="http://www.ibm.com/xmlns/prod/sn">186</snx:orgId></entry>
Make sure content type is application/atom+xml

Sorry I missed the activity part, can you try below and share the exact error you get if any.
API : /activities/service/atom2/acl?activityUuid=
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<contributor>
<email>abc#org.com</email>
</contributor>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="person" />
<snx:role component="http://www.ibm.com/xmlns/prod/sn/activities">member</snx:role>
</entry>

Related

Resourse permission checker Liferay 7

I have my portlet with CRUD-operations (different bundles, services, etc.).
I want to implement custom actions in permission for this portlet.
I create default.xml file:
<?xml version="1.0"?>
<resource-action-mapping>
<portlet-resource>
<portlet-name>com.mypackage.MyPortlet</portlet-name>
<permissions>
<supports>
<action-key>STACKOVERFLOW_ACTION</action-key>
</supports>
</permissions>
</portlet-resource>
</resource-action-mapping>
And create portlet.properties:
include-and-override=portlet-ext.properties
resource.actions.configs=resource-actions/default.xml
The questions is - why do I have nothing in control panel besides default actions life "ADD_TO_PAGE", etc? What am I doing wrong?
UPD:
This varient doesn't work too. =(
<?xml version="1.0"?>
<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 7.0.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_7_0_0.dtd">
<resource-action-mapping>
<model-resource>
<model-name>mypackage.web.portlet.MyPortlet</model-name>
<portlet-ref>
<portlet-name>mypackage_web_portlet_MyPortlet</portlet-name>
</portlet-ref>
<root>true</root>
<weight>1</weight>
<permissions>
<supports>
<action-key>VIEW_TEST</action-key>
</supports>
<site-member-defaults>
<action-key>SUBSCRIBE_TEST</action-key>
</site-member-defaults>
<guest-defaults />
<guest-unsupported>
<action-key>ADD_ENTRY_TEST</action-key>
<action-key>PERMISSIONS_TEST</action-key>
<action-key>SUBSCRIBE_TEST</action-key>
</guest-unsupported>
</permissions>
</model-resource>
You should use the <model-resource> block rather than <portlet-resource>: Portlet-Resource is handled by Liferay (and uses the predefined vocabulary) while your portlet or service introduces its own datatypes, on which you can define your own permissions.

Cruise Control .NET Security

I am attempting to implement LDAP authentication, along with the required permissions.
<internalSecurity>
<cache type="inMemoryCache" duration="60" mode="sliding" />
<audit>
<xmlFileAudit location="D:\Logs\CCNet_Audit.xml"/>
</audit>
<auditReader type="xmlFileAuditReader" location="D:\Logs\CCNet_Audit.xml"/>
<users>
<ldapUser name="*username*" domain="*localdomain*"/>
</users>
<permissions>
<rolePermission name="Admin" forceBuild="Allow" sendMessage="Allow" startProject="Allow" changeProject="Allow" viewSecurity="Allow" modifySecurity="Allow" viewProject="Allow" viewConfiguration="Allow" >
<users>
<userName name="*username*"/>
</users>
</rolePermission>
</permissions>
Inside my project I have the following XML:
<project name="TestProject" description="TestProject" queue="Q7">
<security type="defaultProjectSecurity" defaultRight="Deny">
<permissions>
<rolePermission name="Admin" ref="Admin"/>
</permissions>
</security>
My log at (D:\Logs\CCNet_Audit.xml) is saying that I am "Denied"
<event><dateTime>2015-08-17T09:30:41.7973762-04:00</dateTime><user>*username*</user><type>Login</type><outcome>Deny</outcome></event>
and the project is unavailable within CC Tray.
My username is correct and I have the domain correct within the configuration (I just don't want to share it).
One thing I have noticed is that There seems to be a case issue within the username that Cruise Control is getting c-Joe.smith versus the english "normalization" of c-Joe.Smith . . . and yes I have tried it both ways.
Any help?
Try setting defaultRight="Allow" for your admin group.
<rolePermission name="Admin" defaultRight="Allow" forceBuild="Allow" sendMessage="Allow" startProject="Allow" changeProject="Allow" viewSecurity="Allow" modifySecurity="Allow" viewProject="Allow" viewConfiguration="Allow" >
<users>
<userName name="*username*"/>
</users>
</rolePermission>

Batch processing Google Contact Groups with API (php)

I'm trying to do batch processing of Google Contact groups. I have batch processing working for the actual contacts, but groups are not behaving. The XML that I send to Google is:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gContact='http://schemas.google.com/contact/2008'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:batch='http://schemas.google.com/gdata/batch'>
<entry>
<batch:id>create</batch:id>
<batch:operation type='insert'/>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#group'/>
<title type='text'>Status:Followup 1</title>
<content type='text'>Status:Followup 1</content>
</entry>
</feed>
The response I got back from google was:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gContact="http://schemas.google.com/contact/2008"
xmlns:gd="http://schemas.google.com/g/2005">
<id>https://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/full/batch/1430425819721000</id>
<updated>2015-04-30T20:30:19.721Z</updated>
<title type="text">Batch Feed</title>
<entry gd:etag=""SHs-ezVSLit7I2A9XRVTFE8PTwU."">
<batch:id>create</batch:id>
<batch:operation type="insert"/>
<batch:status code="201" reason="Created."/>
<id>http://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/base/4b9f4f69095d670d</id>
<updated>2015-04-30T20:30:19.553Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2015-04-30T20:30:19.553Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
<title/>
<content>Status:Followup 1</content>
<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*"
href="https://www.google.com/m8/feeds/photos/media/awallace%40ihouseweb.com/4b9f4f69095d670d"/>
<link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/full/4b9f4f69095d670d"/>
<link rel="edit" type="application/atom+xml"
href="https://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/full/4b9f4f69095d670d"/>
</entry>
</feed>
(note, there were actually 4 groups in my batch, but the results were identical).
The groups in my account were unchanged. I have successfully added and deleted groups one at a time (without the batch syntax/url). The result XML here says explicitly that the group was created (), but the title element is empty in the return. ()
Any ideas?
Thanks,
Andy
I had a similar problem when batch creating groups. My problem was I had no entry for gd:extendedProperty:
eg:
<?xml version="1.0"?>
<feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" xmlns:gContact="http://schemas.google.com/contact/2008" xmlns:batch="http://schemas.google.com/gdata/batch">
<entry>
<batch:id>create</batch:id>
<batch:operation type="insert"/>
<atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#group"/>
<atom:title type="text">Test 1</atom:title>
<gd:extendedProperty name="Test 1">
<info>Test 1</info>
</gd:extendedProperty>
</entry>
...
</feed>
The XML markup you have appears to be for updating an existing group. Have a look at the documentation for more info:
https://developers.google.com/google-apps/contacts/v3/#batch_operations_for_contact_groups

Adding groups as members to a Connections community through the API

I am looking for a way to add a group as a member to community when I know the groupName (from the Directory Server).
When I add a group to a community through the UI I can pick from existings groups, but I have not found the API equivalent of this call yet.
Is does not seem to be a profile, entering the snx:userid
<snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">AB16E3DF-D544-4984-94AE-FAAC7A5F2AA6</snx:userid>
To the profileservice endpoint:
https://CONNECTIONSHOST/profiles/atom/profile.do?userid=AB16E3DF-D544-4984-94AE-FAAC7A5F2AA6
Does not return a profile...
So the question is , how can I add a (LDAP) group as a member to a community when I don't have the sn:userid but only the groupname ?
Try the following
METHOD = POST
AUTHORIZATION = {BASIC}|{OAUTH}
CONTENT-TYPE application/atom+xml
URL PATTERN = communities/service/atom/community/members?communityUuid=${communityUuid}
METHOD POST
Where the communityUuid is the community's unique id
The payload should be
<?xml version="1.0" encoding="UTF-8"?>
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<contributor>
<snx:userid>ID OF GROUP</snx:userid>
<snx:role>member</snx:role>
</contributor>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="group"></category>
<snx:role component="http://www.ibm.com/xmlns/prod/sn/activities">member</snx:role>
</entry>
Then replace the ID of Group with your group's ID, and then you will be able to add the group to the community.

Tsung Issue with Dyn_Variable

I am very new to ERLANG and TSung, I never worked in this areas, but I am very much keen to know the fundamentals and do distributed load test for my web application. I am in half the way to complete, but I have a big hurdle and not able to moving forward , please read below tsung.xml file and advise me where & what I am missing?
**===> tsung.xml (this file perfectly working without any errors)**
*<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel = "debug" dumptraffic="true" version="1.0">
<clients>
<client host="localhost" weight ="1" maxusers="40000" cpu = "1" >
<ip value = '127.000.000.111'/>
</client>
</clients>
<servers>
<server host="127.000.000.112" port="80" type="tcp"></server>
</servers>
<load duration="1" unit="minute">
<arrivalphase phase="1" duration="1" unit="minute">
<users arrivalrate="10" unit="second"></users>
</arrivalphase>
</load>
<sessions>
<session name="mySession" probability="100" type="ts_http">
<transaction name="trx">
<request>
<dyn_variable name="myId" re="<myId>(\.*)\</myId>"/> <-- Trying with RegExp option, not getting the value myId
<!--dyn_variable name="myId" xpath="//response/myId" /--> <-- Trying with xpath option, not getting the value myId
<!--dyn_variable name="myId" jsonpath="response.myId" /--> <-- Trying with jsonpath option, not getting the value myId
<http url='http://127.000.000.112/Create_Rec' method='POST' version='1.1' content_type='text/xml'/>
</request>
<request subst="true">
<http url='http://999.000.000.999/Get_Rec/myId=%%_myId%%' method='GET' version='1.1' content_type='application/xml'/>
</request>
</transaction>
</session>
</sessions>
</tsung>*
When I run this url (it is web service call) "http://_127.000.000.112/Create_Rec" in the web browser, I get the following similar response from Server (in the back ground it creates the record in database and generates new id i.e. myId). When I run above tsung.xml, the first request working perfectly fine as I expected.
===> response (browser response)
<response id="SomeWebService">
<status>
<statusCode>1</statusCode>
<statusMsg>SomeMessage</statusMsg>
<statusTime>2013-06-20 02:52:25</statusTime>
</status>
<myId>298346728934734987</myId>
</response>
What I am looking here, I need to grab the myId from first request and pass into second request myId=%%_myId%%, but it is never working and myId always empty string. I am beyond of dyn_variable since two days, no clue and proper examples/documentation on it. Please suggest me, what I am missing.
You will have to set up the subst="true" in your request for substitution to work. So, your request should change to..
<request subst="true">
If still it doesn't work then I would suggest you to see the tsung.dump file and check the response which you are getting from server