08-12-2016 12:55 PM
org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException: Unauthorized
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:466)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:635)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:120)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1028)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:75)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:449)
at test.documentlibrary.services.impl.DocumentLibraryImpl.createDocument(DocumentLibraryImpl.java:305)
at test.documentlibrary.services.DocumentLibraryTest.createDocument_Success(DocumentLibraryTest.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:207)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:178)
String filename = "test.txt";
Session session = getUserSession(getLoggedUser());
Folder rootAgency = (Folder) session.getObjectByPath("/agencies/agency1");
// Create a Map of objects with the props we want to set
Map <String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
properties.put(PropertyIds.NAME, filename);
// I am getting variables length, mimeType and inputStream as paramaters
ContentStream contentStream = session.getObjectFactory().createContentStream(filename, length, mimeType, inputStream);
Document doc = rootAgency.createDocument(
properties,
contentStream,
VersioningState.MAJOR);
{
"userName":"unittestuser1",
"firstName":"Test User Name",
"lastName":"Last Name for User Test",
"email":"testuser@company.com",
"password":"password",
"disableAccount":false,
"quota":-1,
"groups":["Collaborator"]
}
{
"url": "\/alfresco\/s\/api\/people\/unittestuser1",
"userName": "unittestuser1",
"enabled": true,
"firstName": "Test User Name",
"lastName": "Last Name for User Test",
"jobtitle": null,
"organization": null,
"organizationId": null,
"location": null,
"telephone": null,
"mobile": null,
"email": "testuser@company.com",
"companyaddress1": null,
"companyaddress2": null,
"companyaddress3": null,
"companypostcode": null,
"companytelephone": null,
"companyfax": null,
"companyemail": null,
"skype": null,
"instantmsg": null,
"userStatus": null,
"userStatusTime": null,
"googleusername": null,
"quota": -1,
"sizeCurrent": 0,
"emailFeedDisabled": false,
"persondescription": null,
"authorizationStatus": null,
"isDeleted": false,
"isAdminAuthority": false
,
"capabilities":
{
"isAdmin":
false
,"isMutable":
true
,"isGuest":
false
},
"groups": [
],
"immutability":
{
}
}
08-15-2016 01:26 PM
POST http://localhost:9090/alfresco/s/api/rootgroups/NewGroup
Payload
{"authority":"Group","shortName":"NewGroup"}
HTTP/1.1 201 Created
{
"data":{
"authorityType": "GROUP",
"shortName": "NewGroup",
"fullName": "GROUP_NewGroup",
"displayName": "NewGroup",
"url": "/api/groups/NewGroup"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
}
{
"userName":"unittestuser1",
"firstName":"Test User Name",
"lastName":"Last Name for User Test",
"email":"testuser@company.com",
"password":"password",
"disableAccount":false,
"quota":-1,
"groups":["GROUP_NewGroup"]
}
"groups": [
{
"itemName": "GROUP_NewGroup",
"displayName": "NewGroup"
}],
08-12-2016 02:59 PM
08-12-2016 05:59 PM
Documentation for /api/groups/{shortName}/children/{fullAuthorityName}
http://127.0.0.1:9090/alfresco/s/index/uri/api/groups/%7BshortName%7D/children/%7BfullAuthorityName%...
Add group or user to a group
POST /alfresco/s/api/groups/{shortName}/children/{fullAuthorityName}
Description: Adds a group or user to a group. The webscript will create a sub group if one does not already exist, with the fullAuthorityName.
You must have "administrator" privileges to modify groups.
If the authority is for a group and doe not exist then it is created.
The webscript returns Status_Created if a new group is created, otherwise it returns Status_OK. If Status_Created returns the new sub group, otherwise returns the group.
{
"data": [
{
"authorityType": "GROUP",
"shortName": "ALFRESCO_ADMINISTRATORS",
"fullName": "GROUP_ALFRESCO_ADMINISTRATORS",
"displayName": "ALFRESCO_ADMINISTRATORS",
"url": "/api/groups/ALFRESCO_ADMINISTRATORS"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "ALFRESCO_MODEL_ADMINISTRATORS",
"fullName": "GROUP_ALFRESCO_MODEL_ADMINISTRATORS",
"displayName": "ALFRESCO_MODEL_ADMINISTRATORS",
"url": "/api/groups/ALFRESCO_MODEL_ADMINISTRATORS"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "ALFRESCO_SEARCH_ADMINISTRATORS",
"fullName": "GROUP_ALFRESCO_SEARCH_ADMINISTRATORS",
"displayName": "ALFRESCO_SEARCH_ADMINISTRATORS",
"url": "/api/groups/ALFRESCO_SEARCH_ADMINISTRATORS"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "EMAIL_CONTRIBUTORS",
"fullName": "GROUP_EMAIL_CONTRIBUTORS",
"displayName": "EMAIL_CONTRIBUTORS",
"url": "/api/groups/EMAIL_CONTRIBUTORS"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "SITE_ADMINISTRATORS",
"fullName": "GROUP_SITE_ADMINISTRATORS",
"displayName": "SITE_ADMINISTRATORS",
"url": "/api/groups/SITE_ADMINISTRATORS"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
{
"authorityType": "GROUP",
"shortName": "site_sitetest1",
"fullName": "GROUP_site_sitetest1",
"displayName": "site_sitetest1",
"url": "/api/groups/site_sitetest1"
,"zones":
[
"APP.SHARE",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "site_sitetest1_{http:\/\/www.alfresco.org\/model\/site\/1.0}site.ReadOnlyRole",
"fullName": "GROUP_site_sitetest1_{http:\/\/www.alfresco.org\/model\/site\/1.0}site.ReadOnlyRole",
"displayName": "site_sitetest1_{http:\/\/www.alfresco.org\/model\/site\/1.0}site.ReadOnlyRole",
"url": "/api/groups/site_sitetest1_%7Bhttp%3A%2F%2Fwww.alfresco.org%2Fmodel%2Fsite%2F1.0%7Dsite.ReadOnlyRole"
,"zones":
[
"APP.SHARE",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "site_sitetest1_SiteCollaborator",
"fullName": "GROUP_site_sitetest1_SiteCollaborator",
"displayName": "site_sitetest1_SiteCollaborator",
"url": "/api/groups/site_sitetest1_SiteCollaborator"
,"zones":
[
"APP.SHARE",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "site_sitetest1_SiteConsumer",
"fullName": "GROUP_site_sitetest1_SiteConsumer",
"displayName": "site_sitetest1_SiteConsumer",
"url": "/api/groups/site_sitetest1_SiteConsumer"
,"zones":
[
"APP.SHARE",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "site_sitetest1_SiteContributor",
"fullName": "GROUP_site_sitetest1_SiteContributor",
"displayName": "site_sitetest1_SiteContributor",
"url": "/api/groups/site_sitetest1_SiteContributor"
,"zones":
[
"APP.SHARE",
"AUTH.ALF"
]
}
,
{
"authorityType": "GROUP",
"shortName": "site_sitetest1_SiteManager",
"fullName": "GROUP_site_sitetest1_SiteManager",
"displayName": "site_sitetest1_SiteManager",
"url": "/api/groups/site_sitetest1_SiteManager"
,"zones":
[
"APP.SHARE",
"AUTH.ALF"
]
}
{
"authorityType": "GROUP",
"shortName": "TestJuanSanin",
"fullName": "GROUP_TestJuanSanin",
"displayName": "TestJuanSanin",
"url": "/api/groups/TestJuanSanin"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
]
,
"paging":
{
"maxItems": 2147483647,
"skipCount": 0,
"totalItems": 27,
"totalItemsRangeEnd": null,
"confidence": "exact"
}
}
Method failed: HTTP/1.1 500 Internal Server Error
{
"data": { }
}
<!– A collaborator can do anything that an editor and a contributor can do –>
<permissionGroup name="Collaborator" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Editor" type="cm:cmobject" />
<includePermissionGroup permissionGroup="Contributor" type="cm:cmobject" />
</permissionGroup>
08-15-2016 12:17 PM
08-15-2016 01:26 PM
POST http://localhost:9090/alfresco/s/api/rootgroups/NewGroup
Payload
{"authority":"Group","shortName":"NewGroup"}
HTTP/1.1 201 Created
{
"data":{
"authorityType": "GROUP",
"shortName": "NewGroup",
"fullName": "GROUP_NewGroup",
"displayName": "NewGroup",
"url": "/api/groups/NewGroup"
,"zones":
[
"APP.DEFAULT",
"AUTH.ALF"
]
}
}
{
"userName":"unittestuser1",
"firstName":"Test User Name",
"lastName":"Last Name for User Test",
"email":"testuser@company.com",
"password":"password",
"disableAccount":false,
"quota":-1,
"groups":["GROUP_NewGroup"]
}
"groups": [
{
"itemName": "GROUP_NewGroup",
"displayName": "NewGroup"
}],
08-19-2016 01:55 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.