Revision 2682
Added by sgarg about 19 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
378 | 378 |
|
379 | 379 |
MetaCatUtil.printMessage("Path Indexing Completed"); |
380 | 380 |
} |
381 |
} |
|
381 |
}
|
|
382 | 382 |
|
383 |
|
|
384 | 383 |
/** |
385 | 384 |
* Control servlet response depending on the action parameter specified |
386 | 385 |
*/ |
... | ... | |
459 | 458 |
String password = null; |
460 | 459 |
String[] groupnames = null; |
461 | 460 |
String sess_id = null; |
462 |
|
|
461 |
name = null; |
|
462 |
|
|
463 | 463 |
// handle login action |
464 | 464 |
if (action.equals("login")) { |
465 | 465 |
PrintWriter out = response.getWriter(); |
... | ... | |
539 | 539 |
+ username); |
540 | 540 |
password = (String) sess.getAttribute("password"); |
541 | 541 |
groupnames = (String[]) sess.getAttribute("groupnames"); |
542 |
name = (String) sess.getAttribute("name"); |
|
542 | 543 |
} |
543 | 544 |
|
544 | 545 |
//make user user username should be public |
... | ... | |
643 | 644 |
out.close(); |
644 | 645 |
} else if (action.equals("getlog")) { |
645 | 646 |
handleGetLogAction(params, request, response, username, groupnames); |
647 |
} else if (action.equals("getloggedinuserinfo")) { |
|
648 |
PrintWriter out = response.getWriter(); |
|
649 |
response.setContentType("text/xml"); |
|
650 |
out.println("<?xml version=\"1.0\"?>"); |
|
651 |
out.println("\n<user>\n"); |
|
652 |
out.println("\n<username>\n"); |
|
653 |
out.println(username); |
|
654 |
out.println("\n</username>\n"); |
|
655 |
if(name!=null){ |
|
656 |
out.println("\n<name>\n"); |
|
657 |
out.println(name); |
|
658 |
out.println("\n</name>\n"); |
|
659 |
} |
|
660 |
if(MetaCatUtil.isAdministrator(username, groupnames)){ |
|
661 |
out.println("<isAdministrator></isAdministrator>\n"); |
|
662 |
} |
|
663 |
if(MetaCatUtil.isModerator(username, groupnames)){ |
|
664 |
out.println("<isModerator></isModerator>\n"); |
|
665 |
} |
|
666 |
out.println("\n</user>\n"); |
|
667 |
out.close(); |
|
646 | 668 |
} else if (action.equals("buildindex")) { |
647 | 669 |
handleBuildIndexAction(params, request, response, username, groupnames); |
648 | 670 |
} else if (action.equals("login") || action.equals("logout")) { |
Also available in: Unified diff
Added a new action - getloggedinuserinfo - which returns information about the user in the following format.
<user>
<username>uid=sgarg,o=NCEAS,dc=ecoinformatics,dc=org</username>
<name>Saurabh Garg</name>
<isAdministrator/>
<isMOderator/>
</user>