Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Evolveum/midpoint
- Loading branch information
Showing
17 changed files
with
721 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
samples/resources/scriptedrest/bitbucket/CreateScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import org.identityconnectors.framework.common.exceptions.AlreadyExistsException | ||
|
||
/* | ||
* Copyright (c) 2010-2016 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
// Parameters: | ||
// The connector sends us the following: | ||
// connection : handler to the REST Client | ||
// (see: http://groovy.codehaus.org/modules/http-builder/apidocs/groovyx/net/http/RESTClient.html) | ||
// configuration : handler to the connector's configuration object | ||
// action: String correponding to the action ("CREATE" here) | ||
// log: a handler to the Log facility | ||
// objectClass: a String describing the Object class (__ACCOUNT__ / __GROUP__ / other) | ||
// id: The entry identifier (OpenICF "Name" atribute. (most often matches the uid) - IF action = CREATE | ||
// attributes: an Attribute Map, containg the <String> attribute name as a key | ||
// and the <List> attribute value(s) as value. | ||
// password: password string, clear text | ||
// options: a handler to the OperationOptions Map | ||
// | ||
// Returns: Create must return UID. | ||
|
||
log.info("Entering "+action+" Script, attributes: "+attributes); | ||
|
||
// detect if user already exists | ||
|
||
resp = connection.get(path: "http://localhost:7990/rest/api/1.0/admin/users", | ||
query: ['start': 0, 'limit': 1, 'filter' : id]); | ||
json = resp.getData(); | ||
log.ok("JSON create search response:\n" + json); | ||
|
||
if (json && json.values && id.equals(json.values[0].name)) { | ||
throw new AlreadyExistsException("User "+id+" already exists"); | ||
} | ||
|
||
|
||
throw new UnsupportedOperationException("not supported operation, only update/delete avatar is implemented"); |
31 changes: 31 additions & 0 deletions
31
samples/resources/scriptedrest/bitbucket/DeleteScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2010-2016 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// Parameters: | ||
// The connector sends the following: | ||
// connection: handler to the REST Client | ||
// (see: http://groovy.codehaus.org/modules/http-builder/apidocs/groovyx/net/http/RESTClient.html) | ||
// configuration : handler to the connector's configuration object | ||
// action: a string describing the action ("DELETE" here) | ||
// log: a handler to the Log facility | ||
// objectClass: a String describing the Object class (__ACCOUNT__ / __GROUP__ / other) | ||
// options: a handler to the OperationOptions Map | ||
// uid: String for the unique id that specifies the object to delete | ||
|
||
log.info("Entering "+action+" Script, uid: "+uid); | ||
|
||
throw new UnsupportedOperationException("not supported operation, only update/delete avatar is implemented"); | ||
|
75 changes: 75 additions & 0 deletions
75
samples/resources/scriptedrest/bitbucket/SchemaScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) 2010-2016 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
import org.identityconnectors.framework.common.objects.AttributeInfo; | ||
import org.identityconnectors.framework.common.objects.AttributeInfoBuilder | ||
import org.identityconnectors.framework.common.objects.Name; | ||
import org.identityconnectors.framework.common.objects.ObjectClassInfo; | ||
import org.identityconnectors.framework.common.objects.ObjectClassInfoBuilder | ||
|
||
// Parameters: | ||
// The connector sends the following: | ||
// connection: handler to the REST Client | ||
// (see: http://groovy.codehaus.org/modules/http-builder/apidocs/groovyx/net/http/RESTClient.html) | ||
// configuration : handler to the connector's configuration object | ||
// action: a string describing the action ("SCHEMA" here) | ||
// log: a handler to the Log facility | ||
// builder: SchemaBuilder instance for the connector | ||
// | ||
// The connector will make the final call to builder.build() | ||
// so the scipt just need to declare the different object types. | ||
|
||
// This sample shows how to create 2 basic ObjectTypes: __ACCOUNT__ and __GROUP__. | ||
// It works with OpenDJ 2.6 REST sample attribute: | ||
// http://docs.forgerock.org/en/opendj/2.6.0/admin-guide/index/appendix-rest2ldap.html | ||
|
||
log.info("Entering "+action+" Script"); | ||
|
||
// Declare the __ACCOUNT__ attributes | ||
|
||
// name | ||
nameAIB = new AttributeInfoBuilder(Name.NAME); | ||
nameAIB.setRequired(true); | ||
nameAIB.setUpdateable(false); | ||
nameAIB.setCreateable(true); // only detect existence | ||
|
||
//avatar -- 256x256 | ||
avatarAIB = new AttributeInfoBuilder("avatar", byte[].class); | ||
avatarAIB.setUpdateable(true); | ||
// read only custom avatars, default.png is ignored | ||
avatarAIB.setReadable(true); // returned only in findByUID/Name | ||
avatarAIB.setReturnedByDefault(false); | ||
|
||
avatarLinkAIB = new AttributeInfoBuilder("avatarLink"); | ||
avatarLinkAIB.setUpdateable(false); // only read, not to send | ||
avatarLinkAIB.setReadable(true); | ||
avatarLinkAIB.setReturnedByDefault(true); | ||
|
||
// if needed: emailAddress, id, displayName, active, slug, ... | ||
|
||
|
||
|
||
accAttrsInfo = new HashSet<AttributeInfo>(); | ||
accAttrsInfo.add(nameAIB.build()); | ||
accAttrsInfo.add(avatarAIB.build()); | ||
accAttrsInfo.add(avatarLinkAIB.build()); | ||
|
||
// Create the __ACCOUNT__ Object class | ||
final ObjectClassInfo ociAccount = new ObjectClassInfoBuilder().setType("__ACCOUNT__").addAllAttributeInfo(accAttrsInfo).build(); | ||
builder.defineObjectClass(ociAccount); | ||
|
||
log.info("Schema script done"); |
Oops, something went wrong.