[pve-devel] r5144 - in pve-access-control/trunk: . PVE/API2

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Sep 14 11:35:52 CEST 2010


Author: dietmar
Date: 2010-09-14 09:35:52 +0000 (Tue, 14 Sep 2010)
New Revision: 5144

Added:
   pve-access-control/trunk/PVE/API2/AccessControl.pm
Modified:
   pve-access-control/trunk/ChangeLog
   pve-access-control/trunk/PVE/API2/Makefile
Log:

	* PVE/API2/AccessControl.pm: moved from pve-manager



Modified: pve-access-control/trunk/ChangeLog
===================================================================
--- pve-access-control/trunk/ChangeLog	2010-09-14 09:22:31 UTC (rev 5143)
+++ pve-access-control/trunk/ChangeLog	2010-09-14 09:35:52 UTC (rev 5144)
@@ -1,5 +1,7 @@
 2010-09-14  Proxmox Support Team  <support at proxmox.com>
 
+	* PVE/API2/AccessControl.pm: moved from pve-manager
+
 	* PVE/: create correct directory hierarchy
 
 	* Makefile (install): use 'verifyapi'

Added: pve-access-control/trunk/PVE/API2/AccessControl.pm
===================================================================
--- pve-access-control/trunk/PVE/API2/AccessControl.pm	                        (rev 0)
+++ pve-access-control/trunk/PVE/API2/AccessControl.pm	2010-09-14 09:35:52 UTC (rev 5144)
@@ -0,0 +1,74 @@
+package PVE::API2::AccessControl;
+
+use strict;
+use warnings;
+
+use PVE::SafeSyslog;
+use Apache2::Const qw(:http);
+
+use PVE::RESTHandler;
+use PVE::API2::User;
+use PVE::API2::Group;
+use PVE::API2::Role;
+use PVE::API2::ACL;
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::User",  
+    path => 'users',
+});
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::Group",  
+    path => 'groups',
+});
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::Role",  
+    path => 'roles',
+});
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::ACL",  
+    path => 'acl',
+});
+
+__PACKAGE__->register_method ({
+    name => 'index', 
+    path => '', 
+    method => 'GET',
+    description => "Directory index.",
+    parameters => {
+    	additionalProperties => 0,
+	properties => {},
+    },
+    returns => {
+	type => 'array',
+	items => {
+	    type => "object",
+	    properties => {
+		subdir => { type => 'string' },
+	    },
+	},
+	links => [ { rel => 'child', href => "{subdir}" } ],
+    },
+    code => sub {
+	my ($param) = @_;
+    
+	my $res = [];
+
+	my $ma = __PACKAGE__->method_attributes();
+
+	foreach my $info (@$ma) {
+	    next if !$info->{subclass};
+
+	    my $subpath = $info->{match_re}->[0];
+
+	    push @$res, { subdir => $subpath };
+	}
+
+	return $res;
+    }});
+
+1;

Modified: pve-access-control/trunk/PVE/API2/Makefile
===================================================================
--- pve-access-control/trunk/PVE/API2/Makefile	2010-09-14 09:22:31 UTC (rev 5143)
+++ pve-access-control/trunk/PVE/API2/Makefile	2010-09-14 09:35:52 UTC (rev 5144)
@@ -1,8 +1,9 @@
 
-API2_SOURCES= 		\
-	ACL.pm		\
-	Role.pm		\
-	Group.pm	\
+API2_SOURCES= 		 \
+	AccessControl.pm \
+	ACL.pm		 \
+	Role.pm		 \
+	Group.pm	 \
 	User.pm
 
 .PHONY: install




More information about the pve-devel mailing list