[Building Sakai] how to add user property into table sakai_user_property

Michael Wenk mjwenk at ucdavis.edu
Thu Oct 6 00:02:05 PDT 2011


You have to get an UserEdit object.

Here's a short example:

UserEdit ue = null;
try {
        ue = userDirectoryService().editUser(current.getId());
} catch (UserNotDefinedException e) {
        log.error("UNDE: Failed to update user " + current.getDisplayName()
+ "(" + current.getEid() + ")", e);
} catch (UserPermissionException e) {
        log.error("UPE: Failed to update user " + current.getDisplayName() +
"(" + current.getEid() + ")", e);
} catch (UserLockedException e) {
        log.error("ULE: Failed to update user " + current.getDisplayName() +
"(" + current.getEid() + ")", e);
}
...

At that point you can grab the properties and use it.  When you're done you
need to do:

userDirectoryService().commitEdit(ue);

and then that should do it.  the userDirectoryService() is a lookup
injection of the bean org.sakaiproject.user.api.UserDirectoryService.

Mike

On Wed, Oct 5, 2011 at 9:10 PM, <swwangl at tsmc.com> wrote:

> Anyone could tell me how to insert a record into sakai_user_property?
>
> This code can not write into table..
> user.getProperties().addPropertyToList(id, "Y");
>
> Thanks a lot
>
>  TSMC PROPERTY This email communication (and any attachments) is
> proprietary information for the sole use of its intended recipient. Any
> unauthorized review, use or distribution by anyone other than the intended
> recipient is strictly prohibited. If you are not the intended recipient,
> please notify the sender by replying to this email, and then delete this
> email and any copies of it immediately. Thank you.
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>



-- 
Michael Wenk
mjwenk at ucdavis.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20111006/da52c8f1/attachment.html 


More information about the sakai-dev mailing list