Clone Role

To clone a role, use the following request:

POST /roles/:id/clone.xml
POST /roles/:id/clone.json

XML Request Example

curl -i -X POST -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass http://onapp.test/roles/21/clone.xml

JSON Request Example

curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass http://onapp.test/roles/21/clone.json

Where:

id – the role ID


XML Output Example

<role> 
<created_at type="datetime">2014-11-08T14:24:33+02:00</created_at> 
<id type="integer">21</id> 
<identifier>b99q74uao0ufw7</identifier> 
<label>Example role - copy(2014-11-08 12:24:33)</label> 
<updated_at type="datetime">2014-11-08T14:24:33+02:00</updated_at> 
<permissions type="array"> 
<permission> 
<created_at type="datetime">2014-11-05T13:12:10+02:00</created_at> 
<id type="integer">533</id> 
<identifier>activity_logs</identifier> 
<label>Any action on activity logs</label> 
<updated_at type="datetime">2014-11-05T13:12:10+02:00</updated_at> 
</permission> 
</permissions> 
</role>

Where:

created_at - the date when the record in the database was created

id - the ID of the role

identifier - the identifier in the database of the role

label - the label of the role, which is by default the "original" role lael with the date when the role has been cloned.

updated_at - the date when the record in the database was updated

permissions - the array with the list of permissions for this role

id - the ID of the permission

label - the name of the permission