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
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.
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
When the policies are listed again the newly edited details are seen
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.
Once you have the IDs required the assignPolicy wasadmin command can be used to assign the policy. Example assign Policy (string libraryId, string policyId)
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)
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