Function Repository Resource:

SetQuestionPermissions

Source Notebook

Set permissions for a deployed QuestionObject

Contributed by: Sylvia Haas and Bob Sandheinrich

ResourceFunction["SetQuestionPermissions"][CloudObject[],pstring]

sets permissions for the specified deployed question object.

ResourceFunction["SetQuestionPermissions"][CloudObject[], class per]

sets permissions for the specified class of users to be per.

ResourceFunction["SetQuestionPermissions"][CloudObject[], {c1per1,}]

sets permissions for multiple classes of users.

Details

The given cloud object must have been deployed using the resource function QuestionDeploy.
ResourceFunction["SetQuestionPermissions"][obj, classper] adds or overwrites any other permissions set for class but does not change settings for other classes.
A deployed QuestionObject has multiple endpoints. Some endpoints are used by the end user for assessment and others are used by the administrator.
ResourceFunction["SetQuestionPermissions"][…,"Public"] sets endpoints required for assessment to public.
ResourceFunction["SetQuestionPermissions"][…,"Private"] resets all permissions to private.
In ResourceFunction["SetQuestionPermissions"][…, class per], per can be "Submit" or "Administer". "Submit" is equivalent to Automatic and gives the specified class of users permissions to access all endpoints required for assessment. "Administer" gives the specified class of users permissions to access all endpoints.

Examples

Basic Examples (3) 

Deploy a question object with default permissions:

In[1]:=
co = ResourceFunction["QuestionDeploy"][
QuestionObject["4 + 2", 
AssessmentFunction[{42, 6 -> 1, 24, 8}]]]["CloudObject"];

Set permissions so a specific user can run assessments in the cloud:

In[2]:=
ResourceFunction[
 "SetQuestionPermissions"][co, {"wpc_prd03@outlook.com" -> "Submit"}]
Out[2]=

Change permissions to private:

In[3]:=
ResourceFunction["SetQuestionPermissions"][co, "Private"]
Out[3]=

Scope (2) 

Deploy a question to the cloud:

In[4]:=
deployed = ResourceFunction["QuestionDeploy"][
  QuestionObject["\!\(\*SqrtBox[\(4\)]\)", AssessmentFunction[{-2 -> True, 0 -> False, 2 -> True, 1 -> False}, <|"ElementwiseAssessment" -> True|>, MaxItems -> 2]]]
Out[4]=

Set permissions so anyone can run assessments in the cloud:

In[5]:=
ResourceFunction["SetQuestionPermissions"][
 deployed["CloudObject"], "Public"]
Out[5]=

Version History

  • 1.0.0 – 12 July 2022

Related Resources

Author Notes

May require WL version 13.1 depending on your local paclets.

License Information