Requirement:
To avoid having to set every field available on the edit screen individually to read only, it would be a lot easier to just use an initializer that sets every field to editable false depending on project role.
The reason I want to use Behaviors for this instead of setting editable false on the status on the workflow, is because my workflow schemes are shared and I don't want the restriction to apply to other projects and I also don't want to have to copy the project over to a clone of the same workflow just to satisfy this requirement.
Basically something like the below:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
// if the current user is in the Users role only, set the issue type to "Story", and lock it
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def usersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
if (Status == Done) {
getFieldById(>>>>>ALL FIELDS<<<<)
.setReadOnly(true)
}