diff --git a/requirements.in b/requirements.in
index 8cf726b5d..46969bdc7 100644
--- a/requirements.in
+++ b/requirements.in
@@ -7,6 +7,7 @@ boto3
cchardet
celery[redis]
cloudaux
+cryptography
datamodel-code-generator
decorator<5 # Internal requirement has decorator pinned to <5.
deepdiff
diff --git a/requirements.txt b/requirements.txt
index d8b36907e..001c422a0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -64,6 +64,7 @@ certifi==2020.12.5
cffi==1.14.5
# via
# bcrypt
+ # cryptography
# google-crc32c
chardet==4.0.0
# via
@@ -89,6 +90,8 @@ cloudaux==1.9.5
# via -r requirements.in
contextlib2==0.6.0.post1
# via schema
+cryptography==3.4.7
+ # via -r requirements.in
datamodel-code-generator==0.11.5
# via -r requirements.in
decorator==4.4.2
diff --git a/ui/src/components/selfservice/SelfService.js b/ui/src/components/selfservice/SelfService.js
index 975e4bdb9..ecd0af9f6 100644
--- a/ui/src/components/selfservice/SelfService.js
+++ b/ui/src/components/selfservice/SelfService.js
@@ -176,6 +176,18 @@ class SelfService extends Component {
this.setState({ permissions });
}
+ handleResetUserChoices() {
+ // This function is called after a user has added a permission set
+ // to their "shopping cart". It will reset advanced settings so they
+ // are not carried over to additional permission sets they add to their
+ // "shopping cart".
+ this.setState({
+ extraActions: [],
+ includeAccounts: [],
+ excludeAccounts: [],
+ });
+ }
+
getCurrentSelfServiceStep() {
const {
admin_bypass_approval_enabled,
@@ -218,6 +230,7 @@ class SelfService extends Component {
handleStepClick={this.handleStepClick.bind(this)}
updatePolicy={this.updatePolicy.bind(this)}
handlePermissionsUpdate={this.handlePermissionsUpdate.bind(this)}
+ handleResetUserChoices={this.handleResetUserChoices.bind(this)}
handleExtraActionsUpdate={this.handleExtraActionsUpdate.bind(this)}
handleIncludeAccountsUpdate={this.handleIncludeAccountsUpdate.bind(
this
diff --git a/ui/src/components/selfservice/SelfServiceStep2.js b/ui/src/components/selfservice/SelfServiceStep2.js
index c38093e8e..b024dc82a 100644
--- a/ui/src/components/selfservice/SelfServiceStep2.js
+++ b/ui/src/components/selfservice/SelfServiceStep2.js
@@ -164,6 +164,8 @@ class SelfServiceStep2 extends Component {
this.props.handlePermissionsUpdate(permissions);
}
);
+ // Reset extraActions, includeAccounts, and excludeAccounts
+ this.props.handleResetUserChoices();
}
}
diff --git a/ui/src/components/selfservice/SelfServiceStep3.js b/ui/src/components/selfservice/SelfServiceStep3.js
index 721c69836..9daa062e6 100644
--- a/ui/src/components/selfservice/SelfServiceStep3.js
+++ b/ui/src/components/selfservice/SelfServiceStep3.js
@@ -43,6 +43,7 @@ class SelfServiceStep3 extends Component {
this.handleJustificationChange = this.handleJustificationChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleAdminSubmit = this.handleAdminSubmit.bind(this);
+ this.onValueChange = this.onValueChange.bind(this);
}
async componentDidMount() {
@@ -122,7 +123,11 @@ class SelfServiceStep3 extends Component {
});
}
- onValueChange() {}
+ onValueChange(newValue, e) {
+ this.setState({
+ new_policy: newValue,
+ });
+ }
buildMonacoEditor() {
const { old_policy, new_policy } = this.state;
@@ -131,7 +136,6 @@ class SelfServiceStep3 extends Component {
@@ -150,8 +154,8 @@ class SelfServiceStep3 extends Component {
}
handleSubmit() {
- const { role, updated_policy } = this.props;
- const { justification, admin_auto_approve } = this.state;
+ const { role } = this.props;
+ const { justification, admin_auto_approve, new_policy } = this.state;
if (!justification) {
return this.setState((state) => ({
messages: ["No Justification is Given"],
@@ -168,7 +172,7 @@ class SelfServiceStep3 extends Component {
change_type: "inline_policy",
action: "attach",
policy: {
- policy_document: JSON.parse(updated_policy),
+ policy_document: JSON.parse(new_policy),
},
},
],
@@ -438,7 +442,6 @@ class SelfServiceStep3 extends Component {