<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How can I create a role at runtime dynamically?</title><link>https://answers.axonivy.com/questions/264/how-can-i-create-a-role-at-runtime-dynamically</link><description>&lt;p&gt;Is there any public APIs to make an IRole at runtime by programming? &lt;/p&gt;
&lt;p&gt;Because in our project, we need a process to handle add/remove IRole automatically (no need to login to Ivy Server and create it by manually)&lt;/p&gt;
&lt;p&gt;Thank you so much.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/264/how-can-i-create-a-role-at-runtime-dynamically" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 20 Jan 2014 09:58:52 -0500</lastBuildDate><item><title>Comment by nghianguyen on Reto Weiss's answer</title><link>https://answers.axonivy.com/questions/264/how-can-i-create-a-role-at-runtime-dynamically#270</link><description>&lt;p&gt;Thanks so much! It works like a charm.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nghianguyen</dc:creator><pubDate>Mon, 20 Jan 2014 09:58:52 -0500</pubDate><guid>https://answers.axonivy.com/questions/264/how-can-i-create-a-role-at-runtime-dynamically#270</guid></item><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/264/how-can-i-create-a-role-at-runtime-dynamically/269</link><description>&lt;p&gt;No, there is no public API at the moment to do this. &lt;/p&gt;
&lt;p&gt;However, there is a non public API to dynamically create new roles:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import ch.ivyteam.ivy.security.IRole;
IRole role = ivy.session.getSecurityContext().getTopLevelRole().createChildRole("roleName", "displayName", "description", null, true);
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Mon, 20 Jan 2014 09:49:14 -0500</pubDate><guid>https://answers.axonivy.com/questions/264/how-can-i-create-a-role-at-runtime-dynamically/269</guid></item></channel></rss>