CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • SOLVED : How do I check for the user that logged in with the REST interface?
Pages: [1]

Author Topic: SOLVED : How do I check for the user that logged in with the REST interface?  (Read 740 times)

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
SOLVED : How do I check for the user that logged in with the REST interface?
September 14, 2010, 11:21:57 am
I know, the answer is probably blatantly obvious but it escapes me.....
for a wrapper function around the REST interface I want to know what user logged in with the REST interface, how do I do that?
Erik
« Last Edit: September 28, 2010, 12:45:34 am by Erik Hommel »
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How do I check for the user that logged in with the REST interface?
September 14, 2010, 01:44:40 pm

i suspect u'll need to write a custom api function for this (we need to allow folks to add their own api's)

basically check the session and retrieve userID (contactID) and ufID (CMS user id) for the logged in REST user

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: How do I check for the user that logged in with the REST interface?
September 14, 2010, 11:22:53 pm
I was writing my own API, but my $user was empty....however, it is a new morning, the sun is up and I'll have another play :-)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: How do I check for the user that logged in with the REST interface?
September 27, 2010, 08:12:45 am
Solved it by adding a little code to the Utils/REST.php:
Code: [Select]
        $username = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
                $valid_user, 'display_name', 'id');
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • SOLVED : How do I check for the user that logged in with the REST interface?

This forum was archived on 2017-11-26.