Hi, If you have Sharepoitn 2010 you can do it like that without code:
you add a field on your form and bind it on the library (category), set it to some value (step2)when you click on your button (your step 2). You can create a Sharepoint designer WF that will be launch when the field (category) is set to your value (step 2) to grant permission on your document, you can use an impersonnation step to do that and you can set the security that you need:
http://www.learningsharepoint.com/2010/07/31/impersonation-in-sharepoint-designer-2010-workflow/