[Owncloud] usenames containing "@" and sharing

Holger Angenent h_zimm01 at uni-muenster.de
Wed Jul 11 10:40:53 UTC 2012


I just checked out the git version (which claims to be ownCloud5 pre
alpha) and tried the same thing. Unfortunately, it still does not work
very well. For example, if you share a file with another user containing
an @ and open the share dialog again, the second part of the username
(in my case, the domain) appears as a group, but the user does not
appear at all. The database entry seems to be correct.
Will this issue be fixed in the near future or do I use the wrong version?

Cheers,
Holger

Am 10.07.2012 16:12, schrieb Michael Gapczynski:
> Sharing is being refactored for the next version of ownCloud. This issue has 
> already been resolved.
>
>
> Michael
>
> On Tuesday, July 10, 2012 04:04:51 PM Holger Angenent wrote:
>> Dear ownClouders,
>>
>> I recently found out that the sharing module of ownCloud is not capable
>> to deal with usernames containing the "@" sign. Especially sharing files
>> with groups, which is handled via an @ between the username and the
>> group does not really work. Since I want to use email addresses as
>> usernames, this is crucial for me.
>>
>> Looking at the code, at least two files have to be modified,
>> files_sharing/lib_share.php and files_sharing/ajax/getitem.php
>>
>> In lib_share.php, the lines:
>>                       } else if ($uid = strstr($uid_shared_with, '@',
>> true)) {
>>                               $uid_shared_with = array($uid);
>>
>> could be replaced by something like:
>>                         } else if ($uid = strstr($uid_shared_with, '@',
>> true)) {
>>                                 // string contains @, check, if it is a
>> group
>>                                 if ($uidPart = strstr($uid, '@', true)) {
>>                                         // username contains @ and
>> shared with group
>>                                         $uid =
>> substr($uid_shared_with,0,strrpos($uid_shared_with, '@'));
>>                                         $uid_shared_with = array($uid);
>>                                 } else {
>>                                         // username contains @ or user
>> without @ shares with group
>>                                         $uidEnd =
>> strrchr($uid_shared_with, '@');
>>                                         if
>> (OC_Group::groupExists($uidEnd)) {
>>                                                 // username does not
>> contain @, but shares with group
>>                                                 $uid_shared_with =
>> array($uid);
>>                                         } else {
>>                                                 // username contains @,
>> but does not share with group
>>                                                 $uid_shared_with =
>> array($uid_shared_with);
>>                                         }
>>                                 }
>>
>>
>> In ajax/getitem.php, instead of
>>                                 if (($pos = strpos($uid_shared_with,
>> '@')) !== false) {
>>
>> you would need something like
>>                                 if (($pos = strrpos($uid_shared_with,
>> '@')) !== false) {
>>                                                 $gid =
>> substr($uid_shared_with, $pos + 1);
>>                                                 if
>> (!isset($item['groups'])) {
>>                                                         $item['groups']
>> = $group;
>>                                                 } else if
>> (is_array($item['groups'])) {
>>                                                         $gidExists = false;
>>                                                         $currentGroups =
>> $item['groups'];
>>                                                         // Check if the
>> group is already included
>>                                                         foreach
>> ($currentGroups as $g) {
>>                                                                 if
>> ($g['gid'] == $gid) {
>>
>> $gidExists = true;
>>                                                                 }
>>                                                         }
>>                                                 }
>>                                         if (!$gidExists) { // check if
>> the part after the @ is a group
>>                                                 if ($path == $source) {
>>                                                         $user =
>> array(array('uid' => $uid_shared_with, 'permissions' =>
>> $rows[$i]['permissions'], 'parentFolder' => false));
>>                                                 } else {
>>                                                         $user =
>> array(array('uid' => $uid_shared_with, 'permissions' =>
>> $rows[$i]['permissions'], 'parentFolder' => basename($path)));
>>                                                 }
>>                                                 if
>> (!isset($item['users'])) {
>>                                                         $item['users'] =
>> $user;
>>                                                 } else if
>> (is_array($item['users'])) {
>>                                                         $item['users'] =
>> array_merge($item['users'], $user);
>>                                                 }
>>                                         } else {
>>
>> I hope, this is still readable. Unfortunately, this still has some
>> problems. In the webinterface, the "Shared" folder seems to be empty,
>> via webdavs, everything is there.
>> By the way, the dropdown menu for sharing is rather small. I would
>> appreciate it, if the width in css/sharing.css would be 32em, so long
>> usernames sharing files with groups would still remain readable.
>>
>> Is anybody able to reproduce this behavior and fix the bug?
>>
>> Cheers, Holger


-- 
Holger Angenent
Westfälische Wilhelms-Universität Münster
Zentrum für Informationsverarbeitung
Röntgenstraße 7-13
48149 Münster
Tel: +49-(0)251-83 31569


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4967 bytes
Desc: S/MIME Kryptografische Unterschrift
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20120711/6d898592/attachment.bin>


More information about the Owncloud mailing list