Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.1:Update
horde3-kronolith
HK-GW-kronolith_2.2_RC1-Fbview_xfb_access.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File HK-GW-kronolith_2.2_RC1-Fbview_xfb_access.patch of Package horde3-kronolith
diff -r 14457cf2ea2c kronolith/perms.php --- a/kronolith/perms.php Thu Nov 29 15:20:49 2007 +0100 +++ b/kronolith/perms.php Thu Nov 29 15:25:36 2007 +0100 @@ -15,6 +15,34 @@ require_once KRONOLITH_BASE . '/lib/base require_once KRONOLITH_BASE . '/lib/base.php'; require_once 'Horde/Group.php'; +function &getFbperms($share) +{ + $fbperms = array(); + $params = $share->get('params'); + if (!is_a($params, 'PEAR_Error')) { + $params = @unserialize($params); + if (isset($params['xfbaccess'])) { + $xfbusers = $params['xfbaccess']; + foreach ($xfbusers as $user) { + $fbperms[$user] = PERMS_READ; + } + } + } + return $fbperms; +} + +function setFbperms($share, $xfbusers) +{ + $fbperms = array(); + $params = $share->get('params'); + if (!is_a($params, 'PEAR_Error')) { + $params = @unserialize($params); + $params['xfbaccess'] = $xfbusers; + $params = serialize($params); + $share->set('params', $params); + } +} + $shares = &Horde_Share::singleton('kronolith'); $groups = &Group::singleton(); $auth = &Auth::singleton($conf['auth']['driver']); @@ -36,6 +64,8 @@ case 'edit': $notification->push($share, 'horde.error'); } elseif (isset($share) && Auth::getAuth() != $share->get('owner')) { exit('permission denied'); + } else { + $fbperms = getFbperms($share); } break; @@ -251,6 +281,24 @@ case 'editform': } } + // Process free/busy permissions. + $fb_names = Util::getFormData('fb_names'); + $fb_read = Util::getFormData('fb_read'); + + $fbperms = getFbperms($share); + foreach ($fb_names as $key => $user) { + if (empty($user)) { + continue; + } + + if (!empty($fb_read[$key])) { + $fbperms[$user] = PERMS_READ; + } else { + unset($fbperms[$user]); + } + } + setFbperms($share, array_keys($fbperms)); + $share->setPermission($perm, false); $share->save(); $notification->push(sprintf(_("Updated \"%s\"."), $share->get('name')), 'horde.success'); diff -r 14457cf2ea2c kronolith/templates/perms/perms.inc --- a/kronolith/templates/perms/perms.inc Thu Nov 29 15:20:49 2007 +0100 +++ b/kronolith/templates/perms/perms.inc Thu Nov 29 15:25:36 2007 +0100 @@ -355,6 +355,61 @@ <td> </td> </tr> +<!-- Extended free/busy Permissions --> +<tr valign="middle"> + <td class="header leftAlign"> + <?php echo Horde::img('user.png', '', '', $registry->getImageDir('horde')) . ' ' . _("Extended free/busy access") ?> + </td> + <td class="header" align="center"> </td> + <td class="header" align="center"><?php echo _("Read") ?></td> + <td class="header" align="center"> </td> + <td class="header" align="center"> </td> + <td class="header" align="center"> </td> + <td class="header"> </td> +</tr> +<?php foreach ($fbperms as $user => $fbperm) { if ($user != $owner) { ?> +<tr> + <td class="light"><?php echo htmlspecialchars(Auth::removeHook($user)) ?><input type="hidden" name="fb_names[<?php echo htmlspecialchars($user) ?>]" value="<?php echo htmlspecialchars($user) ?>" /></td> + <td align="center"> </td> + <td align="center"> + <input type="checkbox" id="fb_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="fb_read[<?php echo htmlspecialchars($user) ?>]"<?php echo ($fbperm & PERMS_READ) ? ' checked="checked"' : '' ?> /> + <label for="fb_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Read") ?></label> + </td> + <td align="center"> </td> + <td align="center"> </td> + <td align="center"> </td> + <td> </td> +</tr> +<?php } } ?> +<!-- New extended free/busy row --> +<tr> +<?php if ($auth->hasCapability('list')): ?> + <td class="light"> + <label for="fb_names_new" class="hidden"><?php echo _("Select a user to add:") ?></label> + <select id="fb_names_new" name="fb_names[||new]"> + <option value=""><?php echo _("Select a user to add:") ?></option> + <?php foreach ($userList as $user) { if (!isset($userperms[$user])) { ?> + <option value="<?php echo htmlspecialchars($user) ?>"><?php echo htmlspecialchars(Auth::removeHook($user)) ?></option> + <?php } } ?> + </select> + </td> +<?php else: ?> + <td class="light"> + <label for="fb_names_new" class="hidden"><?php echo _("User to add:") ?></label> + <input type="text" id="fb_names_new" name="fb_names[||new]" /> + </td> +<?php endif; ?> + <td align="center"> </td> + <td align="center"> + <input type="checkbox" id="fb_read_new" name="fb_read[||new]" /> + <label for="fb_read_new" class="hidden"><?php echo _("Read") ?></label> + </td> + <td align="center"> </td> + <td align="center"> </td> + <td align="center"> </td> + <td> </td> +</tr> + <tr> <td colspan="7"> </td> </tr>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor