[Building Sakai] Import available users from a file to Sakai

Phuc Bui phucbui2006 at yahoo.com.vn
Wed May 13 23:25:53 PDT 2009


Dear Steve and all,

With user in LDAP, I can map it successfully.

But my problem is that the input of my tool is the output file of another
application. When students enter the university, they will update their
information by that application. Now if I need the data of the students, I
have to read the output file of that app.

I have followed your instruction to use UserDirectoryService but I cannot
call the method addUser(.) from class
org.sakaiproject.user.api.UserDirectoryService, so I use this class
org.sakaiproject.user.cover.UserDirectoryService instead. And it worked.

 

But I have another problem. I use library jxl.jar
(http://jexcelapi.sourceforge.net/) to read data from excel file. I have
added it to project build path.

But when I install my project, it cannot compile.

....................

Downloading:
http://source.sakaiproject.org/maven2-ibiblio/jta/jta/h2.1.8/jta-h2

.1.8.pom

Downloading: http://repo1.maven.org/maven2/jta/jta/h2.1.8/jta-h2.1.8.pom

Downloading:
http://myfaces.zones.apache.org/dist/maven-repository/jta/jta/h2.1.

8/jta-h2.1.8.pom

Downloading: http://repo1.maven.org/maven2/jta/jta/h2.1.8/jta-h2.1.8.pom

[INFO] [compiler:compile]

[INFO] Compiling 6 source files to
F:\workspaces\thesis_workspaces\import-user\i

mpl\m2-target\classes

[INFO]
------------------------------------------------------------------------

[ERROR] BUILD FAILURE

[INFO]
------------------------------------------------------------------------

[INFO] Compilation failure

 

F:\workspaces\thesis_workspaces\import-user\impl\src\java\org\sakaiproject\i
mpor

tuser\logic\ImportUserLogicImpl.java:[19,11] package jxl does not exist

 

F:\workspaces\thesis_workspaces\import-user\impl\src\java\org\sakaiproject\i
mpor

tuser\logic\ImportUserLogicImpl.java:[20,11] package jxl does not exist

 

....................

So I would like to ask you how to use external library in Sakai project J

I have tried this command to install jar file to maven lib, it tells BUILD
SUCCESSFULLY.

mvn install:install-file -DgroupId=jexcelapi -DartifactId=jxl
-Dversion=2.6.9 -Dpackaging=jar -Dfile=jxl.jar

 

Thanks,

Phuc Bui

 

From: Steve Swinsburg [mailto:s.swinsburg at lancaster.ac.uk] 
Sent: Wednesday, May 13, 2009 11:01 PM
To: Phuc Bui
Cc: sakai-dev at collab.sakaiproject.org
Subject: Re: [Building Sakai] Import available users from a file to Sakai

 

Hi Phuc,

 

It's the UserDirectoryService for creating user accounts. This would be a
good enhancement to the existing Admin User's tool, to be able to create
accounts in bulk. Would be good to extend that if possible.

 

Here's the Javadocs for 2.5.4:

http://source.sakaiproject.org/release/2.5.4/apidocs/

Find UserDirectoryService (the org.sakaiproject.user.api one) in the list
and check out it's methods. You want the addUser() method. Note that the
first parameter, the id, can be null and it will be autogenerated, which is
generally what you want so you get the UUID.

 

Either that or have your users in LDAP, hook it up to Sakai and you don't
need to do anything, their accounts will be mapped automatically when they
first login.

 

 

cheers,

Steve

 

---

Steve Swinsburg

Portal Systems Developer
Centre for e-Science
Lancaster University
Lancaster

LA1 4YT

 

email: s.swinsburg at lancaster.ac.uk

phone: +44 (0) 1524 594870

 

 

 

 





 

On 13 May 2009, at 16:51, Phuc Bui wrote:





Dear Steve,

I would like to develop a tool in Sakai so that users can have a view to
create users.

My problem is that: every year, when students enter university, I will have
the data of them, then I will make these students as Sakai's users.

So would you tell me which API to do this J

Thanks,

Phuc Bui

 

From: Steve Swinsburg [mailto:s.swinsburg at lancaster.ac.uk] 
Sent: Wednesday, May 13, 2009 7:10 PM
To: Phuc Bui
Cc: sakai-dev at collab.sakaiproject.org
Subject: Re: [Building Sakai] Import available users from a file to Sakai

 

Hi Phuc,

 

Best to use the API. You can use the web services to iterate over a file and
create user accounts.

 

I've attached a (crude) Perl script and a sample CSV file.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090514/42802ee3/attachment.html 


More information about the sakai-dev mailing list