diff --git a/src/cli/one_helper/onevnet_helper.rb b/src/cli/one_helper/onevnet_helper.rb index 3d46a45aad..8b1a94c5be 100644 --- a/src/cli/one_helper/onevnet_helper.rb +++ b/src/cli/one_helper/onevnet_helper.rb @@ -51,11 +51,12 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper CLIHelper.print_header(str_h1 % ["VIRTUAL NETWORK #{vn.id.to_s} INFORMATION"]) - str="%-10s: %-20s" + str="%-15s: %-20s" puts str % ["ID", vn.id.to_s] puts str % ["USER", vn['UNAME']] puts str % ["GROUP", vn['GNAME']] puts str % ["PUBLIC", OpenNebulaHelper.boolean_to_str(vn['PUBLIC'])] + puts str % ["USED LEASES", vn['TOTAL_LEASES']] puts CLIHelper.print_header(str_h1 % ["VIRTUAL NETWORK TEMPLATE"], false) diff --git a/src/oca/java/src/org/opennebula/client/user/User.java b/src/oca/java/src/org/opennebula/client/user/User.java index adf73f0f5f..1f31f589b8 100644 --- a/src/oca/java/src/org/opennebula/client/user/User.java +++ b/src/oca/java/src/org/opennebula/client/user/User.java @@ -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); - } } diff --git a/src/oca/java/test/AclTest.java b/src/oca/java/test/AclTest.java index 0b8e4e5d95..a48d9c5d8e 100644 --- a/src/oca/java/test/AclTest.java +++ b/src/oca/java/test/AclTest.java @@ -68,7 +68,7 @@ public class AclTest { for(Acl rule : aclPool) { - if( rule.id() != 0 ) + if( rule.id() != 0 && rule.id() != 1 ) { rule.delete(); } @@ -81,7 +81,7 @@ public class AclTest res = aclPool.info(); assertTrue( !res.isError() ); - assertEquals(1, aclPool.getLength()); + assertEquals(2, aclPool.getLength()); } @Test @@ -219,13 +219,13 @@ public class AclTest assertTrue( !res.isError() ); aclPool.info(); - assertTrue( aclPool.getLength() == 2 ); + assertTrue( aclPool.getLength() == 3 ); res = Acl.delete(client, res.getIntMessage()); assertTrue( !res.isError() ); aclPool.info(); - assertTrue( aclPool.getLength() == 1 ); + assertTrue( aclPool.getLength() == 2 ); } catch (RuleParseException e) { diff --git a/src/oca/java/test/GroupTest.java b/src/oca/java/test/GroupTest.java index b83e6f462e..5b1fbe47b7 100644 --- a/src/oca/java/test/GroupTest.java +++ b/src/oca/java/test/GroupTest.java @@ -133,7 +133,8 @@ public class GroupTest } // Commented out, secondary groups do not exist any more -// @Test +/* + @Test public void userGroupRelations() { Hashtable users = new Hashtable(); @@ -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() ) ); } - +*/ } diff --git a/src/oca/ruby/OpenNebula/User.rb b/src/oca/ruby/OpenNebula/User.rb index a2425f7bcc..03d7ed2195 100644 --- a/src/oca/ruby/OpenNebula/User.rb +++ b/src/oca/ruby/OpenNebula/User.rb @@ -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