Folie 1 - DrupalCon Munich 2012
Folie 1 - DrupalCon Munich 2012
Folie 1 - DrupalCon Munich 2012
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
15<br />
Database-level integration<br />
• npm install drupal<br />
1 /**<br />
2 * Validate that the user sesion is valid and matches the uid provided.<br />
3 */<br />
4 function validate_session(uid, sid, callback) {<br />
5 // Validate the user's session.<br />
6 drupal.user.session_load(sid, function (err, session) {<br />
7 // Load the user object from Drupal.<br />
8 drupal.user.load(uid, function (err, user) {<br />
9 drupal.user.role_permissions(user.roles, function (perms) {<br />
10 user.permissions = perms;<br />
11 callback(null, user);<br />
12 });<br />
13 });<br />
14 });<br />
15 }<br />
torsdag den 23. august 12