mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
ALF-3709: User Status on Profile. Added cm:userStatusTime datetime property to cm:person and exposed the current value via the GET userprofile webscript. Time property is updated by userprofile webscript if status property is updated. Also added userstatus POST webscript.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21405 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
"skype": <#if person.properties.skype??>"${person.properties.skype}"<#else>null</#if>,
|
||||
"instantmsg": <#if person.properties.instantmsg??>"${person.properties.instantmsg}"<#else>null</#if>,
|
||||
"userStatus": <#if person.properties.userStatus??>"${person.properties.userStatus}"<#else>null</#if>,
|
||||
"userStatusTime": <#if person.properties.userStatusTime??>{ "iso8601": ${xmldate(person.properties.userStatusTime)}}<#else>null</#if>,
|
||||
"googleusername": <#if person.properties.googleusername??>"${person.properties.googleusername}"<#else>null</#if>,
|
||||
"quota": <#if person.properties.sizeQuota??>${person.properties.sizeQuota?c}<#else>-1</#if>,
|
||||
"sizeCurrent": <#if person.properties.sizeCurrent??>${person.properties.sizeCurrent?c}<#else>0</#if>,
|
||||
|
@@ -54,6 +54,12 @@ function main()
|
||||
|
||||
// set simple text properties
|
||||
user.properties[propname] = propval;
|
||||
|
||||
// update userStatusTime if updating userStatus
|
||||
if (propname.toLowerCase() == "cm:userstatus")
|
||||
{
|
||||
user.properties["cm:userStatusTime"] = new Date();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,10 +79,10 @@ function main()
|
||||
user.properties[propname].content = propval;
|
||||
}
|
||||
}
|
||||
|
||||
user.save();
|
||||
model.success = true;
|
||||
}
|
||||
|
||||
user.save();
|
||||
model.success = true;
|
||||
}
|
||||
|
||||
main();
|
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>User Status</shortname>
|
||||
<description>User Status POST for update</description>
|
||||
<format default="json" />
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
<url>/slingshot/profile/userstatus</url>
|
||||
</webscript>
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"success": ${success?string}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* User Status REST Update method
|
||||
*
|
||||
* @method POST
|
||||
* @param json {string}
|
||||
* {
|
||||
* status: "value"
|
||||
* }
|
||||
*/
|
||||
|
||||
function main()
|
||||
{
|
||||
model.success = false;
|
||||
|
||||
if (json.has("status"))
|
||||
{
|
||||
var newStatus = json.get("status");
|
||||
if (newStatus != null)
|
||||
{
|
||||
person.properties["cm:userStatus"] = newStatus;
|
||||
person.properties["cm:userStatusTime"] = new Date();
|
||||
}
|
||||
|
||||
person.save();
|
||||
model.success = true;
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
Reference in New Issue
Block a user