Show error message when trying to get calendars with no access.

This commit is contained in:
Nathan Gray 2015-11-10 23:31:55 +00:00
parent 9a1f24e3a4
commit 3209a6671c
3 changed files with 15 additions and 4 deletions

View File

@ -179,10 +179,10 @@ class calendar_ui
*
* @return boolean/string false if there's no error or string with error-message
*/
function check_owners_access()
function check_owners_access($users = null, &$no_access = array())
{
$no_access = $no_access_group = array();
$owner_array = explode(',',$this->owner);
$owner_array = $users ? $users : explode(',',$this->owner);
foreach($owner_array as $idx => $owner)
{
$owner = trim($owner);
@ -205,8 +205,10 @@ class calendar_ui
}
if (count($no_access))
{
egw_framework::message(lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access)),'error');
$message = lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access));
egw_framework::message($message,'error');
$this->owner = implode(',',$owner_array);
return $message;
}
if (count($no_access_group))
{

View File

@ -483,6 +483,12 @@ class calendar_uilist extends calendar_ui
// Add in some select options
$users = is_array($search_params['users']) ? $search_params['users'] : explode(',',$search_params['users']);
if($message = $this->check_owners_access($users,$no_access))
{
egw_json_response::get()->error($message);
}
foreach($users as $owner)
{
if(!is_int($owner) && $this->bo->resources[$owner[0]])

View File

@ -199,6 +199,9 @@ app.classes.calendar = AppJS.extend(
*
* App is responsible for only reacting to "messages" it is interested in!
*
* Calendar binds listeners to the data cache, so if the data is updated, the widget
* will automatically update itself.
*
* @param {string} _msg message (already translated) to show, eg. 'Entry deleted'
* @param {string} _app application name
* @param {(string|number)} _id id of entry to refresh or null