Difference between revisions of "Documentation/DevGuide/Database/Group Service"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Documentation/Developers Guide/Database Access)
m (FINAL VERSION FOR L10N)
Line 6: Line 6:
 
|NextPage=Documentation/DevGuide/Database/User Service
 
|NextPage=Documentation/DevGuide/Database/User Service
 
}}
 
}}
{{DISPLAYTITLE:Group Service}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Database/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Group Service}}
 
The service <idl>com.sun.star.sdbcx.Group</idl> is the first of the two security services, <code>Group</code> and <code>User</code>. The <code>Group</code> service represents the group account that has access permissions to a secured database and it has a <code>Name</code> property to identify it. It supports the interface <idl>com.sun.star.sdbcx.XAuthorizable</idl> that allows current privilege settings to be obtained, and to grant or revoke privileges. The second interface is the <idl>com.sun.star.sdbcx.XUsersSupplier</idl>. The word 'Supplier' in the interface name identifies the group object as a container for users. The container returned here is a collection of all users that belong to this group.
 
The service <idl>com.sun.star.sdbcx.Group</idl> is the first of the two security services, <code>Group</code> and <code>User</code>. The <code>Group</code> service represents the group account that has access permissions to a secured database and it has a <code>Name</code> property to identify it. It supports the interface <idl>com.sun.star.sdbcx.XAuthorizable</idl> that allows current privilege settings to be obtained, and to grant or revoke privileges. The second interface is the <idl>com.sun.star.sdbcx.XUsersSupplier</idl>. The word 'Supplier' in the interface name identifies the group object as a container for users. The container returned here is a collection of all users that belong to this group.
  

Revision as of 12:51, 15 May 2009



The service com.sun.star.sdbcx.Group is the first of the two security services, Group and User. The Group service represents the group account that has access permissions to a secured database and it has a Name property to identify it. It supports the interface com.sun.star.sdbcx.XAuthorizable that allows current privilege settings to be obtained, and to grant or revoke privileges. The second interface is the com.sun.star.sdbcx.XUsersSupplier. The word 'Supplier' in the interface name identifies the group object as a container for users. The container returned here is a collection of all users that belong to this group.

Group


 // print all groups and the users with their privileges who belong to this group
 public static void printGroups(XTablesSupplier xTabSup) throws com.sun.star.uno.Exception, SQLException {
     System.out.println("Example printGroups");
     XGroupsSupplier xGroupsSup = (XGroupsSupplier)UnoRuntime.queryInterface(
     XGroupsSupplier.class, xTabSup);
     if (xGroupsSup != null) {
         // the table must be at least support a XColumnsSupplier interface
         System.out.println("--- Groups ---");
         XNameAccess xGroups = xGroupsSup.getGroups();
         String [] aGroupNames = xGroups.getElementNames();
         for (int i =0; i < aGroupNames.length; i++) {
             System.out.println(" " + aGroupNames[i]);
             XUsersSupplier xUsersSup = (XUsersSupplier)UnoRuntime.queryInterface(
                 XUsersSupplier.class, xGroups.getByName(aGroupNames[i]));
             if (xUsersSup != null) {
                 XAuthorizable xAuth = (XAuthorizable)UnoRuntime.queryInterface(
                     XAuthorizable.class, xUsersSup);
                 // the table must be at least support a XColumnsSupplier interface
                 System.out.println("\t--- Users ---");
                 XNameAccess xUsers = xUsersSup.getUsers();
                 String [] aUserNames = xUsers.getElementNames();
                 for (int j = 0; j < aUserNames.length; j++) {
                     System.out.println("\t " + aUserNames[j] + 
                     " Privileges: " + xAuth.getPrivileges(aUserNames[j], PrivilegeObject.TABLE));
                 }
             }
         }
     }
 }


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages