Skip to content
Open
51 changes: 51 additions & 0 deletions examples/archetype_github_roles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<archetype xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oid="c7cf7874-fced-43e2-a6ec-e6677303a545">
<name>GitHub Roles</name>
<description>Archetype to represent GitHub groups as role objects in MidPoint. Roles created
under this archetype correspond to external GitHub groups and can be used to manage
membership assignments and synchronize entitlements.
</description>
<activation/>
<displayName>Archetype for GitHub roles</displayName>
<inducement id="4">
<construction>
<resourceRef oid="53278f8a-4157-4bc0-a38a-2c73233cdda6" relation="org:default" type="c:ResourceType"/>
<kind>account</kind>
<intent>default</intent>
<association id="5">
<ref>ri:groupMembership</ref>
<outbound>
<strength>strong</strength>
<expression>
<associationFromLink>
<projectionDiscriminator xsi:type="c:ShadowDiscriminatorType">
<kind>entitlement</kind>
<intent>group</intent>
</projectionDiscriminator>
</associationFromLink>
</expression>
</outbound>
</association>
</construction>
<order>2</order>
<focusType>UserType</focusType>
</inducement>
<inducement id="11">
<targetRef oid="e12c658d-2b5d-4ead-bae0-33adcf63f11b" relation="org:default" type="c:RoleType">
</targetRef>
</inducement>
<archetypePolicy>
<display>
<label>GitHub group</label>
<pluralLabel>GitHub groups</pluralLabel>
<tooltip>GitHub groups</tooltip>
<icon>
<cssClass>fa-brands fa-github</cssClass>
<color>#060842</color>
</icon>
</display>
</archetypePolicy>
<superArchetypeRef oid="00000000-0000-0000-0000-000000000328" relation="org:default" type="c:ArchetypeType"/>
</archetype>
17 changes: 17 additions & 0 deletions examples/github_accounts_objectCollection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Contas do GitHub</name>
<type>c:ShadowType</type>
<filter>
<q:text>resourceRef matches (oid = '3d7106d0-95a6-4071-a3b3-50102ddda781') and kind = 'account'</q:text>
</filter>
<getOptions>
<option id="4">
<options>
<raw>true</raw>
<errorHandling>
<reportingMethod>default</reportingMethod>
</errorHandling>
</options>
</option>
</getOptions>
</objectCollection>
45 changes: 45 additions & 0 deletions examples/github_dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<dashboard xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oid="ae7c93f2-c08f-4d25-a6c2-8d7cf0dead16">
<name>github-dashboard</name>
<display>
<label>
<t:orig>Painel GitHub</t:orig>
<t:norm>painel github</t:norm>
<t:translation>
<t:key>GithubDashboard.title</t:key>
</t:translation>
</label>
</display>
<widget id="1">
<identifier>github-aacounts</identifier>
<description>Widget that shows all the github accounts.</description>
<display>
<label>GitHub Accounts</label>
<color>#00a65a</color>
<icon>
<cssClass>fa fa-database</cssClass>
</icon>
</display>
<data>
<sourceType>objectCollection</sourceType>
<collection>
<collectionRef oid="15c9cb58-f8b4-4c59-a46b-adfea2f41e4c" relation="org:default" type="c:ObjectCollectionType"/>
</collection>
</data>
<presentation>
<dataField id="19">
<fieldType>value</fieldType>
<expression>
<proportional>
<style>value-only</style>
</proportional>
</expression>
</dataField>
<dataField id="20">
<fieldType>unit</fieldType>
<expression>
<value>contas no GitHub</value>
</expression>
</dataField>
</presentation>
</widget>
</dashboard>
20 changes: 20 additions & 0 deletions examples/github_seats_objectCollection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oid="3887f359-bcd6-4250-be36-e178ecb63319">
<name>Licenças ativas do GitHub Copilot</name>
<type>c:ShadowType</type>
<filter>
<q:text>resourceRef matches (oid = '3d7106d0-95a6-4071-a3b3-50102ddda781') and kind = 'generic' and intent = 'seat'</q:text>
</filter>
<getOptions>
<option id="4">
<options>
<raw>true</raw>
<errorHandling>
<reportingMethod>default</reportingMethod>
</errorHandling>
</options>
</option>
</getOptions>
</objectCollection>
22 changes: 22 additions & 0 deletions examples/github_unmatched_accounts_objectCollection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Contas órfãs do GitHub</name>
<type>c:ShadowType</type>
<filter>
<q:text>resourceRef matches (oid = '3d7106d0-95a6-4071-a3b3-50102ddda781') and kind =
'account' and synchronizationSituation equal 'UNMATCHED'
</q:text>
</filter>
<getOptions>
<option id="4">
<options>
<raw>true</raw>
<errorHandling>
<reportingMethod>default</reportingMethod>
</errorHandling>
</options>
</option>
</getOptions>
</objectCollection>
51 changes: 51 additions & 0 deletions examples/metarole_count_seats.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<role xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oid="e12c658d-2b5d-4ead-bae0-33adcf63f11b">
<name>metarole-count-seats</name>
<assignment id="9">
<identifier>limit-seats</identifier>
<policyRule>
<policyConstraints>
<custom id="11">
<presentation>
<message>
<fallbackMessage>
Maximum number of seats reached.
</fallbackMessage>
</message>
</presentation>
<expression>
<script>
<code>
import com.evolveum.midpoint.xml.ns._public.common.common_3.*
import com.evolveum.midpoint.prism.query.*


// here is oid of meta-role to count seats
def roleOid = "e12c658d-2b5d-4ead-bae0-33adcf63f11b"

def count = midpoint.countObjects(
UserType.class,
prismContext.queryFor(UserType.class)
.item(UserType.F_ROLE_MEMBERSHIP_REF).ref(roleOid)
.build()
)

return count &gt;= 1000
</code>
</script>
</expression>
</custom>
</policyConstraints>
<policyActions>
<enforcement/>
</policyActions>
</policyRule>
<activation>
<administrativeStatus>enabled</administrativeStatus>
</activation>
</assignment>
<activation/>
<displayName>GitHub Seats</displayName>
</role>
Loading