How do I use sdkjs dynamically to set the document read-only

It seems this is a slightly different case (hiding content control for certain users). However, we are working on the both cases.