Beispiel #1
0
            $access = array();
            if (!is_array($function_params['templates'])) {
                $access[$function_params['templates']] = 1;
            } else {
                foreach ($function_params['templates'] as $templateid) {
                    $access[$templateid] = 1;
                }
            }

            $user->GrantTemplateAccess($access);
        }

        // Check if we need to grant extra segments access to the user
        if (isset($function_params['segments'])) {
            $user->RevokeSegmentAccess();

            $access = array();
            if (!is_array($function_params['segments'])) {
                $access[$function_params['segments']] = 1;
            } else {
                foreach ($function_params['segments'] as $segmentid) {
                    $access[$segmentid] = 1;
                }
            }

            $user->GrantSegmentAccess($access);
        }

        if ($editMode) {
            $result = $user->Save(true);