2.7 Share Settings

2.7.1 Resource Representations

AssignedSharingPermission


{
   "principal": Recipient Resource,
   "sharing": SharingPermission Resource
}

ExternalSharingRestriction


{
   "mode": string ("none", "whitelist" or "blacklist"),
   "email_list": [ string ],
   "domain_list": [ string ]
}

Recipient


{
   "type": string ("user" or "group") 
   "id": long,
   "href": string
}  

ShareSettings


{
   "allow_sharing_with_ldap_groups": boolean,
   "sharing_permissions": [
      AssignedSharingPermission Resource
   ],
   "external_restrictions": ExternalSharingRestrictions Resource
}     

2.7.2 Get Settings


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings
 
[Response]
{
   "href":"/admin/share_settings",
   "links":[{
      "rel":"permissions",
      "href":"/admin/share_settings/permissions"
   },{
      "rel":"external_restrictions",
      "href":"/admin/share_settings/external_restrictions"
   }],
   "allow_sharing_with_ldap_groups":true,
   "sharing_permissions":[{
      "principal":{
         "id":1,
         "type":"user",
         "href":"/users/1"
      },
      "sharing":{
         "internal":true,
         "external":true,
         "public":true,
         "all_internal":true,
         "all_external":false,
         "public_link":true,
         "grant_reshare":true
      }
   },{
      "principal":{
         "id":2,
         "type":"group",
         "href":"/groups/2"
      },
      "sharing":{
         "internal":true,
         "external":true,
         "public":true,
         "all_internal":true,
         "all_external":false,
         "public_link":true,
         "grant_reshare":true
      }
   }],
   "external_restrictions":{
      "mode":"none",
      "email_list":[],
      "domain_list":[]
   }
}

2.7.3 Modify Settings

To modify the share settings, PUT a ShareSettings object to the share_settings related link (href: "/admin/share_settings").  Only the attributes that are included in the request body are updated. 


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings \
  -X PUT -H "Content-Type: application/json" -d '{"allow_sharing_with_ldap_groups":false}'

[Response]
{
...(ShareSettings Resource)
}

Modify Sharing Permissions

The permissions related link (href: "/admin/sharing/permissions") allows you to deal with just the permissions portion of Share Settings.  


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings/permissions
 
[Response]
[{
   "principal":{
      "id":1,
      "type":"user",
      "href":"/users/1"
   },
   "sharing":{
      "internal":true,
      "external":true,
      "public":true,
      "all_internal":true,
      "all_external":false,
      "public_link":true,
      "grant_reshare":true
   }
},{
   "principal":{
      "id":2,
      "type":"group",
      "href":"/groups/2"
   },
   "sharing":{
      "internal":true,
      "external":true,
      "public":true,
      "all_internal":true,
      "all_external":false,
      "public_link":true,
      "grant_reshare":true
   }
}]

To add a new permission, POST an AssignedSharingPermission to the permissions related link:


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings/permissions \
  -X POST -H "Content-Type: application/json" -d '{"principal":{"id":20,"type":"user"},"sharing":{"internal":true}}'
 
[Response]
[
...(full list of AssigneSharingPermission objects)
]

To replace the whole list of permissions, PUT a list of AssignedSharingPermission objects to the permissions related link:


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings/permissions \
  -X PUT -H "Content-Type: application/json" \
  -d '[{"principal":{"id":20,"type":"user"},"sharing":{"internal":true}},
       {"principal":{"id":21,"type":"user"},"sharing":{"internal":true}}]'
 
[Response]
[
...(full list of AssignedSharingPermission objects)
]  

To delete all permissions, make a DELETE request to the permissions related link:


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings/permissions -X DELETE

[Empty Response] 

Modify External Sharing Restrictions

The external_restrictions related link (href: "/admin/sharing/external_restrictions") allows you to deal with just the external sharing restrictions of the Share Settings.


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings/external_restrictions

[Response]
{"mode":"none","email_list":[],"domain_list":[]}

To update the external sharing restrictions settings, PUT an ExternalSharingRestrictions object to the external_restrictions related link.


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/share_settings/external_restrictions \
  -X PUT -H "Content-Type: application/json" \
  -d '{"mode":"whitelist", "domain_list":["novell.com","microfocus.com"]}'

[Response]
{"mode":"whitelist","email_list":[],"domain_list":["microfocus.com","novell.com"]}