Skip to content

Work with Files Policies

Working with file policies can be sometimes a pain.

You must have the UUID of the policy, the size that is required in the long format e.g. 2 GB = 2147483648L

Edit example

Python
FilesPolicyService.edit("2d93497d-065a-4022ae25-a4b52598d11a", "My Policy", 2147483648L)

Using the cnxFilesPolicies.py script will allow you to add, edit or delete a file policy. The script will also list the policies on the system.

bild38

For instance to edit the community file policy and increase the size to 1 GB, select edit, select the policy number, you may rename a policy or press enter to leave the name the same, add the new size

bild39

When the policies are listed again the newly edited details are seen

bild40

Add policies to personal or community libraries

If the previous script is used to add a new policy and would like to add it to the personal and community libraries the UUID from Policy and Community is required.

Using the FilesLibraryService can be tricky, a lot of information is returned and it can be difficult to find the IDs required.

bild41

Once you have the IDs required the assignPolicy wasadmin command can be used to assign the policy. Example assign Policy (string libraryId, string policyId)

Python
FilesLibraryService.assignPolicy("f0d01111-9b21-4dd8-b8be-8825631cb84b","2d93497d-065a-4022ae25-a4b52598d11a")

The cnxLibraryPolicies.py can be used to easily facilitate this.

This script is still a POC but is very affective. The scripts lists all of the Communities and Policies In the example below – the test environment has 19 libraries (a mixture of personal and community)

bild42

The script prompts for the library that you wish to assign the new policy to, and the policy that you wish to assign – it’s as simple as that.

In the example policy 5 2GB has been assigned to personal libraries 0 & 1

bild43