1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Feature #1742: secondary groups actions in Java OCA

This commit is contained in:
Carlos Martín 2013-08-26 18:17:55 +02:00
parent 7b8659a7c4
commit d5cc5ea07a

View File

@ -36,6 +36,8 @@ public class User extends PoolElement{
private static final String CHAUTH = METHOD_PREFIX + "chauth";
private static final String UPDATE = METHOD_PREFIX + "update";
private static final String QUOTA = METHOD_PREFIX + "quota";
private static final String ADDGROUP = METHOD_PREFIX + "addgroup";
private static final String DELGROUP = METHOD_PREFIX + "delgroup";
/**
* Creates a new User representation.
@ -146,6 +148,33 @@ public class User extends PoolElement{
return client.call(CHGRP, id, gid);
}
/**
* Adds the User to a secondary group
*
* @param client XML-RPC Client.
* @param id The user id (uid) of the target user we want to modify.
* @param gid The new group ID.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse addgroup(Client client, int id, int gid)
{
return client.call(ADDGROUP, id, gid);
}
/**
* Removes the User from a secondary group. Fails if the
* group is the main one
*
* @param client XML-RPC Client.
* @param id The user id (uid) of the target user we want to modify.
* @param gid The group ID.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse delgroup(Client client, int id, int gid)
{
return client.call(DELGROUP, id, gid);
}
/**
* Changes the auth driver and the password of the given user
*
@ -242,6 +271,29 @@ public class User extends PoolElement{
return chgrp(client, id, gid);
}
/**
* Adds the User to a secondary group
*
* @param gid The new group ID.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse addgroup(int gid)
{
return addgroup(client, id, gid);
}
/**
* Removes the User from a secondary group. Fails if the
* group is the main one
*
* @param gid The group ID.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse delgroup(int gid)
{
return delgroup(client, id, gid);
}
/**
* Changes the auth driver and the password of the given user
*