[vhffs-dev] [1920] display group menu everywhere we use an object related to a group |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1920
Author: gradator
Date: 2012-01-22 01:37:37 +0100 (Sun, 22 Jan 2012)
Log Message:
-----------
display group menu everywhere we use an object related to a group
Modified Paths:
--------------
trunk/TODO
trunk/vhffs-api/src/Vhffs/Panel/Acl.pm
trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
trunk/vhffs-api/src/Vhffs/Panel/DNS.pm
trunk/vhffs-api/src/Vhffs/Panel/Git.pm
trunk/vhffs-api/src/Vhffs/Panel/Mail.pm
trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm
trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm
trunk/vhffs-api/src/Vhffs/Panel/Object.pm
trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
trunk/vhffs-api/src/Vhffs/Panel/Repository.pm
trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
trunk/vhffs-api/src/Vhffs/Panel/Web.pm
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/TODO 2012-01-22 00:37:37 UTC (rev 1920)
@@ -18,7 +18,7 @@
clean description new object (\r)
-disparition du groupe sur le panel sur certains objets
-
corriger tableau ACL
+changement langue prefs d'un objet d'un projet
+
Modified: trunk/vhffs-api/src/Vhffs/Panel/Acl.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Acl.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Acl.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -64,6 +64,7 @@
$panel->render('misc/message.tt', { message => sprintf( gettext('Cannot get informations on object #%d'), $oid) } );
return;
}
+ $panel->set_group( $object->get_group );
# Object exists, we need to know if access is granted to the user
unless( $user->can_view( $object ) ) {
Modified: trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -185,6 +185,7 @@
$panel->render('misc/message.tt', { message => gettext( 'Cannot get informations on this object' ) } );
return;
}
+ $panel->set_group( $bazaar->get_group );
unless( $user->can_view( $bazaar ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -242,8 +243,7 @@
if($bazaar->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION) {
if($bazaar->commit > 0) {
- my $group = Vhffs::Group::get_by_gid( $vhffs , $bazaar->{'owner_gid'} );
- my $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+ my $url = '?do=groupview&group='.$bazaar->get_group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
$panel->redirect($url);
return 1;
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cron.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cron.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -182,6 +182,7 @@
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') } );
return;
}
+ $panel->set_group( $cron->get_group );
unless( $user->can_view($cron) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
Modified: trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -188,6 +188,7 @@
$panel->render('misc/message.tt', { message => gettext( 'Cannot get informations on this object' ) } );
return;
}
+ $panel->set_group( $cvs->get_group );
unless( $user->can_view($cvs) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -205,9 +206,11 @@
$cvs->set_public($want_public);
$cvs->set_status(Vhffs::Constants::WAITING_FOR_MODIFICATION);
if($cvs->commit > 0) {
- $panel->add_info(gettext("CVS repository updated"));
+ my $url = '?do=groupview&group='.$cvs->get_group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+ $panel->redirect($url);
+ return;
} else {
- $panel->add_error(gettext("An error occured during CVS repository update"));
+ $panel->add_error(gettext('An error occured during CVS repository update'));
}
}
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/DNS.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/DNS.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -416,6 +416,7 @@
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') } );
return;
}
+ $panel->set_group( $dns->get_group );
unless( $user->can_view( $dns ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
Modified: trunk/vhffs-api/src/Vhffs/Panel/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -190,6 +190,7 @@
$panel->render('misc/message.tt', { message => gettext( 'Cannot get informations on this object' ) } );
return;
}
+ $panel->set_group( $git->get_group );
unless( $user->can_view( $git ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -247,8 +248,7 @@
if($git->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION) {
if($git->commit > 0) {
- my $group = Vhffs::Group::get_by_gid( $vhffs , $git->{'owner_gid'} );
- my $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+ my $url = '?do=groupview&group='.$git->get_group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
$panel->redirect($url);
return 1;
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mail.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mail.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -184,13 +184,19 @@
my $user = $panel->{'user'};
my $mail_config = $vhffs->get_config->get_service('mail');
+
my $domain = $cgi->param('name');
+ unless( defined $domain ) {
+ $panel->render('misc/message.tt', { message => gettext( 'CGI Error !' ) } );
+ return;
+ }
my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain );
unless( defined $mail ) {
$panel->render('misc/message.tt', { message => sprintf( gettext('Unable to get information on mail domain %s'), $domain ) } );
return;
}
+ $panel->set_group( $mail->get_group );
unless( $user->can_view($mail) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
Modified: trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -225,6 +225,9 @@
return;
}
+ my $group = $list->get_group;
+ $panel->set_group( $group );
+
unless( $user->can_view( $list ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
return;
@@ -242,7 +245,6 @@
my $vars = { list => $list };
- my $group = Vhffs::Group::get_by_gid( $vhffs , $list->get_owner_gid );
$vars->{group_emails} = join("\n", map { $_->{mail} } @{$group->get_users});
$panel->set_title( sprintf(gettext('Administration for list %s'), $list->get_localpart.'@'.$list->get_domain) );
Modified: trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -191,6 +191,7 @@
$panel->render('misc/message.tt', { message => gettext( 'Cannot get informations on this object' ) } );
return;
}
+ $panel->set_group( $mercurial->get_group );
unless( $user->can_view( $mercurial ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -248,8 +249,7 @@
if($mercurial->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION) {
if($mercurial->commit > 0) {
- my $group = Vhffs::Group::get_by_gid( $vhffs , $mercurial->{'owner_gid'} );
- my $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+ my $url = '?do=groupview&group='.$mercurial->get_group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
$panel->redirect($url);
return 1;
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -179,17 +179,17 @@
my $user = $panel->{'user'};
my $dbname = $cgi->param('name');
- my $mysql = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $dbname );
-
unless( defined $dbname ) {
$panel->render('misc/message.tt', { message => gettext( 'CGI Error !' ) } );
return;
}
+ my $mysql = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $dbname );
unless( defined $mysql ) {
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') } );
return;
}
+ $panel->set_group( $mysql->get_group );
unless( $user->can_view( $mysql ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -213,13 +213,10 @@
my $cgi = $panel->{'cgi'};
my $user = $panel->{'user'};
- my $group = Vhffs::Group::get_by_gid( $vhffs , $mysql->{'owner_gid'} ) if defined $mysql;
-
- unless( defined $group and $user->can_modify($mysql) ) {
+ unless( $user->can_modify($mysql) ) {
$panel->add_error( gettext('You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights') );
return 0;
}
- $panel->set_group( $group );
my $new_passwd = $cgi->param('newpassword');
unless(defined $new_passwd) {
@@ -239,7 +236,7 @@
return 0;
}
- my $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('Password change request taken in account, please wait for processing');
+ my $url = '?do=groupview&group='.$mysql->get_group->get_groupname.'&msg='.gettext('Password change request taken in account, please wait for processing');
$panel->redirect($url);
return 1;
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Object.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Object.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -68,11 +68,11 @@
require Vhffs::Object;
my $object = Vhffs::Object::get_by_oid( $vhffs , $cgi->param('oid') );
-
unless( defined $object ) {
$panel->render('misc/message.tt', { message => gettext( 'Cannot get information on this object') });
return;
}
+ $panel->set_group( $object->get_group );
unless( $user->can_view($object) ) {
$panel->render('misc/message.tt', { message => gettext('You\'re not allowed to view this object\'s ACL') });
@@ -97,11 +97,13 @@
return;
}
+ require Vhffs::ObjectFactory;
my $object = Vhffs::ObjectFactory::fetch_object( $vhffs , $oid );
unless(defined $object) {
$panel->render('misc/message.tt', { message => gettext('This object does not exist') } );
return;
}
+ $panel->set_group( $object->get_group ) unless $object->get_type == Vhffs::Constants::TYPE_GROUP;
unless($object->get_status == Vhffs::Constants::VALIDATION_REFUSED ) {
$panel->render('misc/message.tt', { message => gettext('This object is not in refused state') } );
@@ -131,8 +133,7 @@
if( $object->get_type == Vhffs::Constants::TYPE_GROUP ) {
$url = '?do=groupindex&msg='.gettext('The new description has been submitted');
} else {
- my $group = Vhffs::Group::get_by_gid( $vhffs , $object->get_owner_gid );
- $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('The new description has been submitted');
+ $url = '?do=groupview&group='.$object->get_group->get_groupname.'&msg='.gettext('The new description has been submitted');
}
$panel->redirect( $url );
return;
@@ -161,11 +162,13 @@
return;
}
+ require Vhffs::ObjectFactory;
my $object = Vhffs::ObjectFactory::fetch_object( $vhffs , $oid );
unless(defined $object) {
$panel->render('misc/message.tt', { message => gettext('This object does not exist') } );
return;
}
+ $panel->set_group( $object->get_group ) unless $object->get_type == Vhffs::Constants::TYPE_GROUP;
unless($object->get_status == Vhffs::Constants::VALIDATION_REFUSED ) {
$panel->render('misc/message.tt', { message => gettext('This object is not in refused state') } );
@@ -182,8 +185,7 @@
if( $object->get_type == Vhffs::Constants::TYPE_GROUP ) {
$url = '?do=groupindex&msg='.gettext('This object has been deleted');
} else {
- my $group = Vhffs::Group::get_by_gid( $vhffs , $object->get_owner_gid );
- $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('This object has been deleted');
+ $url = '?do=groupview&group='.$object->get_group->get_groupname.'&msg='.gettext('This object has been deleted');
}
$panel->redirect( $url );
return;
Modified: trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -169,17 +169,17 @@
my $user = $panel->{'user'};
my $dbname = $cgi->param('name');
- my $pgsql = Vhffs::Services::Pgsql::get_by_dbname( $vhffs , $dbname );
-
unless( defined $dbname ) {
$panel->render('misc/message.tt', { message => gettext( 'CGI Error !' ) } );
return;
}
+ my $pgsql = Vhffs::Services::Pgsql::get_by_dbname( $vhffs , $dbname );
unless( defined $pgsql ) {
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') } );
return;
}
+ $panel->set_group( $pgsql->get_group );
unless( $user->can_view( $pgsql ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -203,13 +203,10 @@
my $cgi = $panel->{'cgi'};
my $user = $panel->{'user'};
- my $group = Vhffs::Group::get_by_gid( $vhffs , $pgsql->{'owner_gid'} ) if defined $pgsql;
-
- unless( defined $group and $user->can_modify($pgsql) ) {
+ unless( $user->can_modify($pgsql) ) {
$panel->add_error( gettext('You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights') );
return 0;
}
- $panel->set_group( $group );
my $new_passwd = $cgi->param('newpassword');
unless(defined $new_passwd) {
@@ -229,7 +226,7 @@
return 0;
}
- my $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('Password change request taken in account, please wait for processing');
+ my $url = '?do=groupview&group='.$pgsql->get_group->get_groupname.'&msg='.gettext('Password change request taken in account, please wait for processing');
$panel->redirect($url);
return 1;
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Repository.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Repository.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -172,6 +172,7 @@
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') });
return;
}
+ $panel->set_group( $repo->get_group );
unless( $user->can_view( $repo ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' )} );
Modified: trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -190,6 +190,7 @@
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') } );
return;
}
+ $panel->set_group( $svn->get_group );
unless( $user->can_view( $svn ) ) {
$panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
@@ -246,8 +247,7 @@
if($svn->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION) {
if($svn->commit > 0) {
- my $group = Vhffs::Group::get_by_gid( $vhffs , $svn->{'owner_gid'} );
- my $url = '?do=groupview&group='.$group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+ my $url = '?do=groupview&group='.$svn->get_group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
$panel->redirect($url);
return;
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2012-01-21 23:42:06 UTC (rev 1919)
+++ trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2012-01-22 00:37:37 UTC (rev 1920)
@@ -138,14 +138,14 @@
sub create_web {
my( $main, $servername, $description, $user, $group ) = @_;
- return undef if( !defined $user );
- return undef if( !defined $group );
+ return undef unless defined $user;
+ return undef unless defined $group;
my $web = Vhffs::Services::Web::create($main, $servername, $description, $user, $group);
- return undef if( ! defined $web );
+ return undef unless defined $web;
- return undef if ( Vhffs::Acl::add_acl( $user , $web , Vhffs::Constants::ACL_DELETE , $main ) < 0 );
- return undef if( Vhffs::Acl::add_acl( $group , $web , Vhffs::Constants::ACL_VIEW , $main ) < 0 );
+ return undef if Vhffs::Acl::add_acl( $user , $web , Vhffs::Constants::ACL_DELETE , $main ) < 0;
+ return undef if Vhffs::Acl::add_acl( $group , $web , Vhffs::Constants::ACL_VIEW , $main ) < 0;
return $web;
}
@@ -240,12 +240,17 @@
my $user = $panel->{'user'};
my $servername = $cgi->param("name");
+ unless( defined $servername ) {
+ $panel->render('misc/message.tt', { message => gettext( 'CGI Error !' ) } );
+ return;
+ }
+
my $web = Vhffs::Services::Web::get_by_servername( $vhffs , $servername );
-
unless( defined($web) ) {
$panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') } );;
return;
}
+ $panel->set_group( $web->get_group );
unless( $web->get_status == Vhffs::Constants::ACTIVATED ) {
$panel->render('misc/message.tt', { message => gettext('This object is not functionnal yet. Please wait creation or moderation.') } );