User permission questions

toejamm10

Joined: 2003-11-11
Posts: 1
Posted: Tue, 2003-11-11 06:14

Let me first off say this is a nice app.

Questions:

1) Is there a way for a user (non Admin) to log in and when they choose to change the permissions to their albums I can disable them to view other members login names? I don't want a user to see the list of all the other users (i.e NOBODY, EVERYBODY ...etc) If so, how? (I believe I have exhausted my search on this forum)

2) Is there a way for a user (non Admin) to log in and when they choose their albums I can limit the choices under the drop down <Admin Options> so lets say I can disable users to choose "poll properties" and/or "poll results" and/or "poll reset"? If so, how? (I believe I have exhausted my search on this forum)

If there is a way to do both of these I'd be happy with a global option for all users, well except for Admin of course :D

Thanks

Running v1.4.1-cvs-b215 on RH 9

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Tue, 2003-11-11 09:14

Moving to customization forum

 
iwantmyphoto

Joined: 2003-11-05
Posts: 98
Posted: Fri, 2003-11-14 23:12

this is exactly what im looking for too. .
If say you have 100 or 1000 users..that long list of names wont look very "professional".. So, maybe users should be able to have choices like "nobody" everybody, loggedin, that's enough..
But on top of that, I'd like to see another feature though..
If a user knows his her friends' ID, and he should be able to grant permission to THAT specific User...
Can someone give us any suggestions...or maybe where to look for change..thanks a lot!

 
newtech

Joined: 2004-08-13
Posts: 83
Posted: Tue, 2004-08-24 02:39

I need the same customization as listed in the first message. There never was a reply to the post. Any body have the answer?

 
newtech

Joined: 2004-08-13
Posts: 83
Posted: Fri, 2004-08-27 07:50

Still need an answer on this

 
giorgos
giorgos's picture

Joined: 2002-08-19
Posts: 115
Posted: Fri, 2005-07-29 18:08

Also there are users that allow (by mistake or not) everybody to add/delete albums, add/delete photos etc. under their own album.
It becomes really messy and a lot of disk space is wasted.
Is there any way not to allow users to use the "EVERYBODY" option to add /delete/ modify/ albums photos or text at their permissions menu?

Thanks in advance

Giorgos

 
brocaa

Joined: 2004-05-06
Posts: 39
Posted: Sat, 2005-07-30 13:27

OK, I think I've understood what you are looking for. What I have done at http://www.moopics.com is to limit the permission choices to everybody and nobody by changing the code in the album_permissions.php file to the following

<?php if ($gallery->user->isAdmin) { ?>
<?php echo drawSelect("allUid", $uAll, isset($allUid) ? $allUid : array(), 28); ?>
<?php }
else { ?>
<input type="checkbox" name="allUid" value="everybody"> EVERYBODY</option><br>
<input type="checkbox" name="allUid" value="nobody"> NOBODY</option>

<?php } ?>

This way the admin can see all the users and the users can only see everybody and nobody. I also set up the albums so that the permission options are limited to "who can see the album" "who can view full images", "add comments" and "view comments"

I saw a gallery site ages ago where you could search for a user but it wasn't integrated into the permissions and I'm currently working on a way to do this now - although I dont know if you can already do it in G2

In answer to the 2nd part essentially you need to do the same thing for the options, either delete the lines of code for the option that you dont want or more it to the section that starts if ($gallery->user->isAdmin)

Hope this helps

 
giorgos
giorgos's picture

Joined: 2002-08-19
Posts: 115
Posted: Sun, 2005-07-31 10:44

brocaa,

Thanks you for your quick reply. I've checked moopics.com and the permissions modifications looks really nice.

For the moment I don’t care that users can see all users ( I think I should wait for the user search solution). What I want is the permission options to be limited to "who can see the album" "who can view full images", "add comments" and "view comments".

But I couldn't make it work.

You said:

Quote:
I also set up the albums so that the permission options are limited to "who can see the album" "who can view full images", "add comments" and "view comments"

How did you do that?

Thanks
Giorgos

ps I saw your portfolio. I will send you a PM regarding a project

 
brocaa

Joined: 2004-05-06
Posts: 39
Posted: Mon, 2005-08-01 20:45

Essentially to limit the options I set the gallery up so that when someone registers it creates them a new album and when they login they are taken directly to this album (there's a couple of posts on the forum as to how to do this but I cant find them right now - from memory there was a post about how to create a new album when someone registers and another post about how to direct someone to their album when they login)

I then changed the default permissions in classes\album.php to get the desired result

Hope this helps

Aaron

 
giorgos
giorgos's picture

Joined: 2002-08-19
Posts: 115
Posted: Mon, 2005-08-01 21:17

Aaron,

Thanks for your help. I will check the posts you mention.
as for changing the default permissions at classes\album.php I was lost.
What needs to be changed there in order that users can see only the 4 options mentioned. Have you got a modified classes\album.php?

Regards
Giorgos

 
brocaa

Joined: 2004-05-06
Posts: 39
Posted: Tue, 2005-08-02 07:59

sorry - think I've confused you

In the classes\album.php file you set the default permissions for the album, eg if all users can see the album or if access is limited to logged in users only.

In album_permissions.php you need to adjust the code to give the specific form options that people can choose from.

I'll be back at my desk tonight and will post a modded copy of the code here for the album_permissions.php for you

 
brocaa

Joined: 2004-05-06
Posts: 39
Posted: Tue, 2005-08-02 21:50

Here's the copy of the modded album_permissions.php file

<?php
/*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2004 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id album_permissions.php,v 1.38 2004/03/04 004947 jenst Exp $
*/
?>
<?php
// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
print _("Security violation") . "\n";
exit;
}

if (!isset($GALLERY_BASEDIR)) {
$GALLERY_BASEDIR = './';
}

require(dirname(__FILE__) . '/init.php');

// Hack check
if (!$gallery->user->isAdmin() &&
!$gallery->user->isOwnerOfAlbum($gallery->album)) {
exit;
}
?>
<?php
$changed=0;
if (isset($allUid) && isset($submit_read) && strchr($submit_read, ">")) {
$gallery->album->setRead($allUid, 1);
$changed++;
} else if (isset($readUid) && isset($submit_read) && strchr($submit_read, "<")) {
$gallery->album->setRead($readUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_text) && strchr($submit_text, ">")) {
$gallery->album->setChangeText($allUid, 1);
$changed++;
} else if (isset($textUid) && isset($submit_text) && strchr($submit_text, "<")) {
$gallery->album->setChangeText($textUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_add) && strchr($submit_add, ">")) {
$gallery->album->setAddTo($allUid, 1);
$changed++;
} else if (isset($addUid) && isset($submit_add) && strchr($submit_add, "<")) {
$gallery->album->setAddTo($addUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_write) && strchr($submit_write, ">")) {
$gallery->album->setWrite($allUid, 1);
$changed++;
} else if (isset($writeUid) && isset($submit_write) && strchr($submit_write, "<")) {
$gallery->album->setWrite($writeUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_delete) && strchr($submit_delete, ">")) {
$gallery->album->setDeleteFrom($allUid, 1);
$changed++;
} else if (isset($deleteUid) && isset($submit_delete) && strchr($submit_delete, "<")) {
$gallery->album->setDeleteFrom($deleteUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_createSub) && strchr($submit_createSub, ">")) {
$gallery->album->setCreateSubAlbum($allUid, 1);
$changed++;
} else if (isset($createSubUid) && isset($submit_createSub) && strchr($submit_createSub, "<")) {
$gallery->album->setCreateSubAlbum($createSubUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_viewFullImages) && strchr($submit_viewFullImages, ">")) {
$gallery->album->setViewFullImages($allUid, 1);
$changed++;
} else if (isset($viewFullImagesUid) && isset($submit_viewFullImages) && strchr($submit_viewFullImages, "<")) {
$gallery->album->setViewFullImages($viewFullImagesUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_addComments) && strchr($submit_addComments, ">")) {
$gallery->album->setAddComments($allUid, 1);
$changed++;
} else if (isset($addCommentsUid) && isset($submit_addComments) && strchr($submit_addComments, "<")) {
$gallery->album->setAddComments($addCommentsUid, 0);
$changed++;
}

if (isset($allUid) && isset($submit_viewComments) && strchr($submit_viewComments, ">")) {
$gallery->album->setViewComments($allUid, 1);
$changed++;
} else if (isset($viewCommentsUid) && isset($submit_viewComments) && strchr($submit_viewComments, "<")) {
$gallery->album->setViewComments($viewCommentsUid, 0);
$changed++;
}

if ( isset($save) && $ownerUid) {
$gallery->album->setOwner($ownerUid);
$changed++;
}

if ($changed) {
$gallery->album->save(array(i18n("Permissions have been changed")));
}

// Start with a default owner of nobody -- if there is an
// owner it'll get filled in below.
$nobody = $gallery->userDB->getNobody();
$ownerUid = $nobody->getUid();

$uRead = $gallery->album->getPermUids("canRead");
$uText = $gallery->album->getPermUids("canChangeText");
$uAdd = $gallery->album->getPermUids("canAddTo");
$uWrite = $gallery->album->getPermUids("canWrite");
$uDelete = $gallery->album->getPermUids("canDeleteFrom");
$uCreateSub = $gallery->album->getPermUids("canCreateSubAlbum");
$uViewFullImages = $gallery->album->getPermUids("canViewFullImages");
$uAddComments = $gallery->album->getPermUids("canAddComments");
$uViewComments = $gallery->album->getPermUids("canViewComments");

foreach ($gallery->userDB->getUidList() as $uid) {
$tmpUser = $gallery->userDB->getUserByUid($uid);
$uname = $tmpUser->getUsername();
$uAll[$uid] = $uname;
}

$owner = $gallery->album->getOwner();
$ownerUid = $owner->getUid();

asort($uRead);
asort($uText);
asort($uWrite);
asort($uDelete);
asort($uCreateSub);
asort($uViewFullImages);
asort($uAddComments);
asort($uViewComments);
asort($uAdd);
asort($uAll);

correctPseudoUsers($uRead, $ownerUid);
correctPseudoUsers($uText, $ownerUid);
correctPseudoUsers($uWrite, $ownerUid);
correctPseudoUsers($uDelete, $ownerUid);
correctPseudoUsers($uCreateSub, $ownerUid);
correctPseudoUsers($uViewFullImages, $ownerUid);
correctPseudoUsers($uAddComments, $ownerUid);
correctPseudoUsers($uViewComments, $ownerUid);
correctPseudoUsers($uAdd, $ownerUid);

?>
<?php doctype() ?>
<html>
<head>
<title><?php echo _("Album Permissions") ?></title>
<?php echo getStyleSheetLink() ?>
</head>
<body dir="<?php echo $gallery->direction ?>">

<center>
<p class="popuphead"><?php echo _("Album Permissions") ?></p>
<div class="popup">
<?php echo sprintf(_("Changing permissions for %s"), '<b>'.$gallery->album->fields["title"] . '</b>');

echo makeFormIntro("album_permissions.php",
array("name" => "albumperms_form")) ?>

<?php if ($gallery->user->isAdmin) { ?>
<?php echo _("Owner") ?> <?php echo drawSelect("ownerUid", $uAll, $ownerUid, 1); ?>
<?php } ?>

<table border="0" cellspacing="0" cellpadding="0" width="90%">
<tr>
<td align="top" valign="top" colspan="3" class="popuptext">To change the permissions select &amp;EVERYBODY&amp; and then click&amp;<input type="submit" value="-->">,&amp;
To change them back simply select &amp;NOBODY&amp; and click&amp;<input type="submit" value="<--">
</td></tr>
<tr><td height="15" colspan="3">&amp;</td></tr>
<tr> <td align="top" valign="top">
<!--AB Ammend -->
<?php if ($gallery->user->isAdmin) { ?>
<?php echo drawSelect("allUid", $uAll, isset($allUid) ? $allUid array(), 28); ?>
<?php }
else { ?>
<input type="checkbox" name="allUid" value="everybody"> EVERYBODY</option><br>
<input type="checkbox" name="allUid" value="nobody"> NOBODY</option>
<!--
<select name="allUid" size=2 >
<option value=everybody >EVERYBODY</option>
<option value=nobody >NOBODY</option>
</select>
-->
<?php } ?>

</td>

<td>&amp; </td>

<td valign=top>
<table border="0" cellspacing="3" cellpadding="0">
<tr>
<td colspan="2" class="popup">
<?php echo _("Users who can see the album") ?>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit_read" value="-->">
<br> <input type="submit" name="submit_read" value="<--">
</td>
<td align="left">
<?php echo drawSelect("readUid", $uRead, isset($readUid) ? $readUid array(), 3); ?>
</td>
</tr>

<tr>
<td colspan="2" class="popup">
<?php echo _("Users who can view full (original) images.") ?>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit_viewFullImages" value="-->">
<br> <input type="submit" name="submit_viewFullImages" value="<--">
</td>
<td>
<?php echo drawSelect("viewFullImagesUid", $uViewFullImages, isset($viewFullImagesUid) ? $viewFullImagesUid array(), 3); ?>

</td>
</tr>

<tr>
<td colspan=2 class="popup">
<?php echo _("Users who can add comments.") ?>
</td>
</tr>
<tr>
<td>
<input type=submit name="submit_addComments" value="-->">
<br> <input type=submit name="submit_addComments" value="<--">
</td>
<td>
<?php echo drawSelect("addCommentsUid", $uAddComments, isset($addCommentsUid) ? $addCommentsUid array(), 3); ?>
</td>
</tr>

<tr>
<td colspan=2 class="popup">
<?php echo _("Users who can view comments.") ?>
</td>
</tr>
<tr>
<td>
<input type=submit name="submit_viewComments" value="-->">
<br> <input type=submit name="submit_viewComments" value="<--">
</td>
<td>
<?php echo drawSelect("viewCommentsUid", $uViewComments, isset($viewCommentsUid) ? $viewCommentsUid array(), 3); ?>
</td>
</tr>

</table>
</td>
</tr>
</table>

<input type="submit" name="save" value="<?php echo _("Save") ?>">
<input type="button" name="done" value="<?php echo _("Done") ?>" onclick='parent.close()'>
</form>

</div>
</center>
<?php print gallery_validation_link("album_permissions.php"); ?>
</body>
</html>

 
giorgos
giorgos's picture

Joined: 2002-08-19
Posts: 115
Posted: Thu, 2005-08-04 14:27

Aaron,

Thanks a lot. Works perfect. Only tiny modification I would like to see is that owner of the album could see the buttons EVERYBODY and NOBODY but also the user list as he could decide to give access to specific users.

regards
Giorgos

 
brocaa

Joined: 2004-05-06
Posts: 39
Posted: Thu, 2005-08-04 14:32

HI

Surely that's what you had in the original list?

Or am I completely miss understanding you

 
giorgos
giorgos's picture

Joined: 2002-08-19
Posts: 115
Posted: Thu, 2005-08-04 20:50

Maybe I mess it up a bit. lets explain with a screenshot

Your modified permissions for the admin looks like this

[img]http://www.dailyalbum.com/admin.jpg[/img]

and for the owner like this

[img]http://www.dailyalbum.com/user.jpg[/img]

I would like that the album owner can see the same as the admin plus the NOBODY and EVERYBODY buttons above the users list.
In other words the owner should be able to assign permissions not only to nobody or everybody but also to other users.

should look like this

[img]http://www.dailyalbum.com/likethis.jpg[/img]

I hope is more clear now.

Thanks
Giorgos

 
brocaa

Joined: 2004-05-06
Posts: 39
Posted: Thu, 2005-08-04 21:30

Hi

Are the options for nobody and everybody in your scroll list?

It's quite easy to do what you want just change the following

<!--AB Ammend -->
<?php if ($gallery->user->isAdmin) { ?>
<?php echo drawSelect("allUid", $uAll, isset($allUid) ? $allUid array(), 28); ?>
<?php }
else { ?>
<input type="checkbox" name="allUid" value="everybody"> EVERYBODY</option><br>
<input type="checkbox" name="allUid" value="nobody"> NOBODY</option>
<!--
<select name="allUid" size=2 >
<option value=everybody >EVERYBODY</option>
<option value=nobody >NOBODY</option>
</select>
-->
<?php } ?>

for

<input type="checkbox" name="allUid" value="everybody"> EVERYBODY</option><br>
<input type="checkbox" name="allUid" value="nobody"> NOBODY</option>
<?php echo drawSelect("allUid", $uAll, isset($allUid) ? $allUid array(), 28); ?>

I think that should do the trick

 
giorgos
giorgos's picture

Joined: 2002-08-19
Posts: 115
Posted: Thu, 2005-08-04 21:50

Thank you very much.
It works fine. except the checkboxes. The do strange. I think I will remove them.

I test it a bit more tomorrow

Regards
Giorgos

 
MyWebsiteAdviser

Joined: 2007-04-12
Posts: 46
Posted: Tue, 2007-07-31 12:58

Hi,

There is detailed Gallery permission article, include how to set up Gallery permission video.

Enjoy,
Create Web Album.