mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
MULTIPLE GROUPS: Finish removing the multiple groups functionality from ruby and java OCA, see commit:66485c6e
This commit is contained in:
parent
439df29713
commit
61120649b9
@ -33,8 +33,6 @@ public class User extends PoolElement{
|
||||
private static final String DELETE = METHOD_PREFIX + "delete";
|
||||
private static final String PASSWD = METHOD_PREFIX + "passwd";
|
||||
private static final String CHGRP = METHOD_PREFIX + "chgrp";
|
||||
private static final String ADDGROUP = METHOD_PREFIX + "addgroup";
|
||||
private static final String DELGROUP = METHOD_PREFIX + "delgroup";
|
||||
|
||||
/**
|
||||
* Creates a new User representation.
|
||||
@ -127,32 +125,6 @@ public class User extends PoolElement{
|
||||
return client.call(CHGRP, id, gid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds this 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 this user from 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 delgroup(Client client, int id, int gid)
|
||||
{
|
||||
return client.call(DELGROUP, id, gid);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Instanced object XML-RPC methods
|
||||
// =================================
|
||||
@ -203,28 +175,6 @@ public class User extends PoolElement{
|
||||
return chgrp(client, id, gid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds this 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 this user from a secondary group
|
||||
*
|
||||
* @param gid The new group ID.
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse delgroup(int gid)
|
||||
{
|
||||
return delgroup(client, id, gid);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Helpers
|
||||
// =================================
|
||||
@ -239,16 +189,4 @@ public class User extends PoolElement{
|
||||
String enabled = xpath("ENABLED");
|
||||
return enabled != null && enabled.equals("1");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the user is part of the group
|
||||
*
|
||||
* @param gid The group ID.
|
||||
* @return whether or not the user is part of the group
|
||||
*/
|
||||
public boolean isPartOf(int gid)
|
||||
{
|
||||
String res = xpath("GROUPS/ID[.="+gid+"]");
|
||||
return res != null && res.equals(""+gid);
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,8 @@ public class GroupTest
|
||||
}
|
||||
|
||||
// Commented out, secondary groups do not exist any more
|
||||
// @Test
|
||||
/*
|
||||
@Test
|
||||
public void userGroupRelations()
|
||||
{
|
||||
Hashtable<String, User> users = new Hashtable<String, User>();
|
||||
@ -221,5 +222,5 @@ public class GroupTest
|
||||
assertTrue( groups.get("d").contains( users.get("c").id() ) );
|
||||
assertTrue( groups.get("d").contains( users.get("d").id() ) );
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
@ -26,9 +26,7 @@ module OpenNebula
|
||||
:allocate => "user.allocate",
|
||||
:delete => "user.delete",
|
||||
:passwd => "user.passwd",
|
||||
:chgrp => "user.chgrp",
|
||||
:addgroup => "user.addgroup",
|
||||
:delgroup => "user.delgroup"
|
||||
:chgrp => "user.chgrp"
|
||||
}
|
||||
|
||||
SELF = -1
|
||||
@ -115,21 +113,5 @@ module OpenNebula
|
||||
def gid
|
||||
self['GID'].to_i
|
||||
end
|
||||
|
||||
# Returns whether or not the user is part of the group 'gid'
|
||||
def is_part_of(gid)
|
||||
return self["GROUPS/ID[.=#{gid}]"] != nil
|
||||
end
|
||||
|
||||
# Returns an array with the numeric group ids
|
||||
def group_ids
|
||||
array = Array.new
|
||||
|
||||
self.each("GROUPS/ID") do |id|
|
||||
array << id.text.to_i
|
||||
end
|
||||
|
||||
return array
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user