WebGUI::User->isInGroup does not take a UID argument anymore.
Grepped all files and fixed these errors: - Passed userId replaced by User object creation and use. - Where $session->user->userId was used, it was removed. Updated POD inside Group.pm
This commit is contained in:
parent
5c00dfcfda
commit
f59f41cd9e
4 changed files with 10 additions and 8 deletions
|
|
@ -80,10 +80,11 @@ sub canAdd {
|
||||||
my $className = shift;
|
my $className = shift;
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
my $userId = shift || $session->user->userId;
|
my $userId = shift || $session->user->userId;
|
||||||
|
my $user = WebGUI::User->new($self->session, $userId);
|
||||||
my $subclassGroupId = shift;
|
my $subclassGroupId = shift;
|
||||||
my $addPrivs = $session->config->get("assetAddPrivilege");
|
my $addPrivs = $session->config->get("assetAddPrivilege");
|
||||||
my $groupId = $addPrivs->{$className} || $subclassGroupId || '12';
|
my $groupId = $addPrivs->{$className} || $subclassGroupId || '12';
|
||||||
return $session->user->isInGroup($groupId,$userId);
|
return $user->isInGroup($groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,10 +103,11 @@ Unique hash identifier for a user. If not supplied, current user.
|
||||||
sub canEdit {
|
sub canEdit {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $userId = shift || $self->session->user->userId;
|
my $userId = shift || $self->session->user->userId;
|
||||||
|
my $user = WebGUI::User->new($self->session, $userId);
|
||||||
if ($userId eq $self->get("ownerUserId")) {
|
if ($userId eq $self->get("ownerUserId")) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return $self->session->user->isInGroup($self->get("groupIdEdit"),$userId);
|
return $user->isInGroup($self->get("groupIdEdit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ sub view {
|
||||||
$var{question} = $self->get("question");
|
$var{question} = $self->get("question");
|
||||||
if ($self->get("active") eq "0") {
|
if ($self->get("active") eq "0") {
|
||||||
$showPoll = 0;
|
$showPoll = 0;
|
||||||
} elsif ($self->session->user->isInGroup($self->get("voteGroup"),$self->session->user->userId)) {
|
} elsif ($self->session->user->isInGroup($self->get("voteGroup"))) {
|
||||||
if ($self->_hasVoted()) {
|
if ($self->_hasVoted()) {
|
||||||
$showPoll = 0;
|
$showPoll = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ This package provides an object-oriented way of managing WebGUI groups and group
|
||||||
$arrayRef = $self->session->user->getGroups($userId);
|
$arrayRef = $self->session->user->getGroups($userId);
|
||||||
$arrayRef = $group->getGroupsIn($recursive);
|
$arrayRef = $group->getGroupsIn($recursive);
|
||||||
$arrayRef = $group->getUsers($groupId);
|
$arrayRef = $group->getUsers($groupId);
|
||||||
$boolean = $self->session->user->isInGroup($groupId, $userId);
|
$boolean = $self->session->user->isInGroup($groupId);
|
||||||
$boolean = $group->userIsAdmin($userId,$groupId);
|
$boolean = $group->userIsAdmin($userId,$groupId);
|
||||||
$epoch = $group->userGroupExpireDate($userId,$groupId);
|
$epoch = $group->userGroupExpireDate($userId,$groupId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ Templated display all messages for the current user.
|
||||||
|
|
||||||
sub www_viewMessageLog {
|
sub www_viewMessageLog {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
my (@msg, $vars);
|
my (@msg, $vars);
|
||||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2,$session->user->userId));
|
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||||
my $i18n = WebGUI::International->new($session);
|
my $i18n = WebGUI::International->new($session);
|
||||||
$vars->{displayTitle} = '<h1>'.$i18n->get(159).'</h1>';
|
$vars->{displayTitle} = '<h1>'.$i18n->get(159).'</h1>';
|
||||||
my $p = WebGUI::Paginator->new($session,$session->url->page('op=viewMessageLog'));
|
my $p = WebGUI::Paginator->new($session,$session->url->page('op=viewMessageLog'));
|
||||||
|
|
@ -100,8 +100,8 @@ Templated display of a single message for the user.
|
||||||
|
|
||||||
sub www_viewMessageLogMessage {
|
sub www_viewMessageLogMessage {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
my ($data, $vars);
|
my ($data, $vars);
|
||||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2,$session->user->userId));
|
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||||
my $i18n = WebGUI::International->new($session);
|
my $i18n = WebGUI::International->new($session);
|
||||||
$vars->{displayTitle} = '<h1>'.$i18n->get(159).'</h1>';
|
$vars->{displayTitle} = '<h1>'.$i18n->get(159).'</h1>';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue