Zimlet JavaScript API Reference - ZmShare

Class ZmShare


A share comprises information about an object that is shared by one user with another user. Currently, only organizers may be shared.

XML representation:

<!ELEMENT share (grantee,grantor,link)>
<!ATTLIST share xmlns CDATA #FIXED "urn:zimbraShare">
<!ATTLIST share version NMTOKEN #FIXED "0.1">
<!ATTLIST share action (new|edit|delete|accept|decline) #REQUIRED>

<!ELEMENT grantee EMPTY>
<!ATTLIST grantee id CDATA #REQUIRED>
<!ATTLIST grantee name CDATA #REQUIRED>
<!ATTLIST grantee email CDATA #REQUIRED>

<!ELEMENT grantor EMPTY>
<!ATTLIST grantor id CDATA #REQUIRED>
<!ATTLIST grantor name CDATA #REQUIRED>
<!ATTLIST grantor email CDATA #REQUIRED>

<!ELEMENT link EMPTY>
<!ATTLIST link id NMTOKEN #REQUIRED>
<!ATTLIST link name CDATA #REQUIRED>
<!ATTLIST link view (appointment|...) #REQUIRED>
<!ATTLISt link perm CDATA #REQUIRED>


Defined in: ZmShare.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmShare(params, granteePwd)
Creates a share with the given information about the sharer, the sharee, and what is being shared.
Field Summary
Field Attributes Field Name and Description
<static>  
ZmShare.ACCEPT
Defines the "accept" action.
<static>  
ZmShare.DECLINE
Defines the "decline" action.
<static>  
ZmShare.DELETE
Defines the "delete" action.
<static>  
ZmShare.EDIT
Defines the "edit" action.
<static>  
ZmShare.NEW
Defines the "new" action.
<static>  
ZmShare.NOTIFY
Defines the "notify" action.
<static>  
ZmShare.PERM_ADMIN
Defines the "admin" allowed permission.
<static>  
ZmShare.PERM_DELETE
Defines the "delete" allowed permission.
<static>  
ZmShare.PERM_INSERT
Defines the "insert" allowed permission.
<static>  
ZmShare.PERM_NOADMIN
Defines the "no admin" restricted permission.
<static>  
ZmShare.PERM_NODELETE
Defines the "no delete" restricted permission.
<static>  
ZmShare.PERM_NOINSERT
Defines the "no insert" restricted permission.
<static>  
ZmShare.PERM_NOREAD
Defines the "no read" restricted permission.
<static>  
ZmShare.PERM_NOWORKFLOW
Defines the "no workflow" restricted permission.
<static>  
ZmShare.PERM_NOWRITE
Defines the "no write" restricted permission.
<static>  
ZmShare.PERM_PRIVATE
Defines the "private" allowed permission.
<static>  
ZmShare.PERM_READ
Defines the "read" allowed permission.
<static>  
ZmShare.PERM_WORKFLOW
Defines the "workflow" allowed permission.
<static>  
ZmShare.PERM_WRITE
Defines the "write" allowed permission.
<static>  
ZmShare.RESEND
Defines the "resend" action.
<static>  
ZmShare.REVOKE
Defines the "revoke" action.
<static>  
ZmShare.ROLE_ADMIN
Defines the "admin" role.
<static>  
ZmShare.ROLE_MANAGER
Defines the "manager" role.
<static>  
ZmShare.ROLE_NONE
Defines the "none" role.
<static>  
ZmShare.ROLE_VIEWER
Defines the "viewer" role.
<static>  
ZmShare.TYPE_ALL
Defines the "all" type.
<static>  
ZmShare.TYPE_COS
Defines the "COS" type.
<static>  
ZmShare.TYPE_DOMAIN
Defines the "domain" type.
<static>  
ZmShare.TYPE_GROUP
Defines the "group" type.
<static>  
ZmShare.TYPE_GUEST
Defines the "guest" type.
<static>  
ZmShare.TYPE_PUBLIC
Defines the "public" type.
<static>  
ZmShare.TYPE_USER
Defines the "user" type.
Method Summary
Method Attributes Method Name and Description
 
accept(name, color, replyType, notes, callback, owner)
Accepts the share.
<static>  
ZmShare.createFromDom(doc)
Creates the share from the DOM.
<static>  
ZmShare.createFromJs(, grant)
Creates the share from JS.
<static>  
ZmShare.getRoleActions(role)
Gets the role actions.
<static>  
ZmShare.getRoleName(role)
Gets the role name.
<static>  
ZmShare.getShareFromGrant(share, oldShare)
Updates a ZmShare that represents a grant
<static>  
ZmShare.getShareFromLink(link, share)
Creates or updates a ZmShare from a ZmOrganizer that's a mountpoint.
<static>  
ZmShare.getShareFromShareInfo(shareInfo, share)
Creates or updates a ZmShare from share info that comes in JSON form from GetShareInfoResponse.
 
grant(perm, pw, replyType, shareAction, batchCmd, batchCmd)
Grants the permission.
 
Checks if the private permission exists on this share.
 
Checks if the admin permission exists on this share.
 
Checks if the grantee type is "all".
 
Checks if the delete permission exists on this share.
 
Checks if the grantee type is "domain".
 
Checks if the grantee type is "group".
 
Checks if the grantee type is "guest".
 
Checks if the insert permission exists on this share.
 
Checks if the given permission exists on this share.
 
Checks if the given permission is restricted for this share.
 
Checks if the grantee type is "public".
 
Checks if the read permission exists on this share.
 
Checks if the grantee type is "user".
 
Checks if the workflow permission exists on this share.
 
Checks if the write permission exists on this share.
 
revoke(callback)
Revokes the share.
 
revokeMultiple(callback, args, batchCmd)
Revokes multiple shares.
<static>  
ZmShare.revokeOrphanGrants(zid, granteeType, callback, batchCmd)
Revokes all grants for the given zid (one whose account has been removed).
 
sendMessage(mode, addrs, owner, batchCmd)
Sends a message.
 
Sets the permission.
 
Returns a string representation of the object.
Class Detail
ZmShare(params, granteePwd)
Creates a share with the given information about the sharer, the sharee, and what is being shared.
Author: Andy Clark.
Parameters:
{Hash} params
a hash of parameters
{Object} params.object
the object being shared
{constant} params.granteeType
the grantee type (see ZmShare.TYPE_ constants) (everyone, or a single user)
{String} params.granteeId
a unique ID for the grantee
{String} params.granteeName
the grantee's name
{String} granteePwd
the grantee's password
{constant} params.perm
the grantee's permissions on the shared object
{Boolean} params.inherit
if true, children inherit share info
{Boolean} params.invalid
if true, the share is invalid
Field Detail
<static> ZmShare.ACCEPT
Defines the "accept" action.

<static> ZmShare.DECLINE
Defines the "decline" action.

<static> ZmShare.DELETE
Defines the "delete" action.

<static> ZmShare.EDIT
Defines the "edit" action.

<static> ZmShare.NEW
Defines the "new" action.

<static> ZmShare.NOTIFY
Defines the "notify" action.

<static> ZmShare.PERM_ADMIN
Defines the "admin" allowed permission.

<static> ZmShare.PERM_DELETE
Defines the "delete" allowed permission.

<static> ZmShare.PERM_INSERT
Defines the "insert" allowed permission.

<static> ZmShare.PERM_NOADMIN
Defines the "no admin" restricted permission.

<static> ZmShare.PERM_NODELETE
Defines the "no delete" restricted permission.

<static> ZmShare.PERM_NOINSERT
Defines the "no insert" restricted permission.

<static> ZmShare.PERM_NOREAD
Defines the "no read" restricted permission.

<static> ZmShare.PERM_NOWORKFLOW
Defines the "no workflow" restricted permission.

<static> ZmShare.PERM_NOWRITE
Defines the "no write" restricted permission.

<static> ZmShare.PERM_PRIVATE
Defines the "private" allowed permission.

<static> ZmShare.PERM_READ
Defines the "read" allowed permission.

<static> ZmShare.PERM_WORKFLOW
Defines the "workflow" allowed permission.

<static> ZmShare.PERM_WRITE
Defines the "write" allowed permission.

<static> ZmShare.RESEND
Defines the "resend" action.

<static> ZmShare.REVOKE
Defines the "revoke" action.

<static> ZmShare.ROLE_ADMIN
Defines the "admin" role.

<static> ZmShare.ROLE_MANAGER
Defines the "manager" role.

<static> ZmShare.ROLE_NONE
Defines the "none" role.

<static> ZmShare.ROLE_VIEWER
Defines the "viewer" role.

<static> ZmShare.TYPE_ALL
Defines the "all" type.

<static> ZmShare.TYPE_COS
Defines the "COS" type.

<static> ZmShare.TYPE_DOMAIN
Defines the "domain" type.

<static> ZmShare.TYPE_GROUP
Defines the "group" type.

<static> ZmShare.TYPE_GUEST
Defines the "guest" type.

<static> ZmShare.TYPE_PUBLIC
Defines the "public" type.

<static> ZmShare.TYPE_USER
Defines the "user" type.
Method Detail
accept(name, color, replyType, notes, callback, owner)
Accepts the share.
Parameters:
name
color
replyType
notes
callback
owner

<static> {ZmShare} ZmShare.createFromDom(doc)
Creates the share from the DOM.
Parameters:
{Object} doc
the document
Returns:
{ZmShare} the resulting share

<static> {ZmShare} ZmShare.createFromJs(, grant)
Creates the share from JS.
Parameters:
grant
Returns:
{ZmShare} the resulting share

<static> {String} ZmShare.getRoleActions(role)
Gets the role actions.
Parameters:
{constant} role
the role (see ZmShare.ROLE_ constants)
Returns:
{String} the actions

<static> {String} ZmShare.getRoleName(role)
Gets the role name.
Parameters:
{constant} role
the role (see ZmShare.ROLE_ constants)
Returns:
{String} the name

<static> ZmShare.getShareFromGrant(share, oldShare)
Updates a ZmShare that represents a grant
Parameters:
share
[ZmShare] folder grant
oldShare
[ZmShare]* share to update

<static> ZmShare.getShareFromLink(link, share)
Creates or updates a ZmShare from a ZmOrganizer that's a mountpoint. The grantee is the current user.
Parameters:
link
[ZmFolder] mountpoint
share
[ZmShare]* share to update

<static> ZmShare.getShareFromShareInfo(shareInfo, share)
Creates or updates a ZmShare from share info that comes in JSON form from GetShareInfoResponse.
Parameters:
shareInfo
[object] JSON representing share info
share
[ZmShare]* share to update

grant(perm, pw, replyType, shareAction, batchCmd, batchCmd)
Grants the permission.
Parameters:
{constant} perm
the permission (see ZmShare.PERM_ constants)
{String} pw
{constant} replyType
ZmShareReply.NONE, ZmShareReply.STANDARD or ZmShareReply.QUICK
{constant} shareAction
the share action, e.g. ZmShare.NEW or ZmShare.EDIT
{ZmBatchCommand} batchCmd
the batch command
batchCmd

{Boolean} hasPrivateAccess()
Checks if the private permission exists on this share.
Returns:
{Boolean} true if the private permission is allowed on this share
See:
ZmShare.PERM_PRIVATE

{Boolean} isAdmin()
Checks if the admin permission exists on this share.
Returns:
{Boolean} true if the admin permission is allowed on this share
See:
ZmShare.PERM_ADMIN

{Boolean} isAll()
Checks if the grantee type is "all".
Returns:
{Boolean} true if type "all"
See:
ZmShare.TYPE_ALL

{Boolean} isDelete()
Checks if the delete permission exists on this share.
Returns:
{Boolean} true if the delete permission is allowed on this share
See:
ZmShare.PERM_DELETE

{Boolean} isDomain()
Checks if the grantee type is "domain".
Returns:
{Boolean} true if type "domain"
See:
ZmShare.TYPE_DOMAIN

{Boolean} isGroup()
Checks if the grantee type is "group".
Returns:
{Boolean} true if type "group"
See:
ZmShare.TYPE_GROUP

{Boolean} isGuest()
Checks if the grantee type is "guest".
Returns:
{Boolean} true if type "guest"
See:
ZmShare.TYPE_GUEST

{Boolean} isInsert()
Checks if the insert permission exists on this share.
Returns:
{Boolean} true if the insert permission is allowed on this share
See:
ZmShare.PERM_INSERT

{Boolean} isPermAllowed(perm)
Checks if the given permission exists on this share.
Parameters:
{constant} perm
the permission (see ZmShare.PERM_ constants)
Returns:
{Boolean} true if the permission is allowed on this share

{Boolean} isPermRestricted(perm)
Checks if the given permission is restricted for this share.
Parameters:
{constant} perm
the permission (see ZmShare.PERM_ constants)
Returns:
{Boolean} true if the permission is restricted on this share

{Boolean} isPublic()
Checks if the grantee type is "public".
Returns:
{Boolean} true if type "public"
See:
ZmShare.TYPE_PUBLIC

{Boolean} isRead()
Checks if the read permission exists on this share.
Returns:
{Boolean} true if the read permission is allowed on this share
See:
ZmShare.PERM_READ

{Boolean} isUser()
Checks if the grantee type is "user".
Returns:
{Boolean} true if type "user"
See:
ZmShare.TYPE_USER

{Boolean} isWorkflow()
Checks if the workflow permission exists on this share.
Returns:
{Boolean} true if the workflow permission is allowed on this share
See:
ZmShare.PERM_WORKFLOW

{Boolean} isWrite()
Checks if the write permission exists on this share.
Returns:
{Boolean} true if the write permission is allowed on this share
See:
ZmShare.PERM_WRITE

revoke(callback)
Revokes the share.
Parameters:
{AjxCallback} callback
the callback

revokeMultiple(callback, args, batchCmd)
Revokes multiple shares.
Parameters:
{AjxCallback} callback
the callback
{Object} args
not used
{ZmBatchCommand} batchCmd
the batch command

<static> ZmShare.revokeOrphanGrants(zid, granteeType, callback, batchCmd)
Revokes all grants for the given zid (one whose account has been removed).
Parameters:
{String} zid
the zimbra ID
{constant} granteeType
the grantee type (see ZmShare.TYPE_ constants)
{AjxCallback} callback
the client callback
{ZmBatchCommand} batchCmd
the batch command

sendMessage(mode, addrs, owner, batchCmd)
Sends a message.
Parameters:
{constant} mode
the request mode
{AjxVector} addrs
a vector of AjxEmailAddress objects or null to send to the grantee
{String} owner
the message owner
{ZmBatchCommand} batchCmd
batchCommand to put the SendMsgRequest into or null to send the message immediately

setPermissions(perm)
Sets the permission.
Parameters:
{constant} perm
the permission (see ZmShare.PERM_ constants)

{String} toString()
Returns a string representation of the object.
Returns:
{String} a string representation of the object

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:39 GMT-0400 (EDT)