[BB-3622] Add course creation condition for organisation

Description

The condition added to ensure that if the feature is enabled
user will not be able to create the course outside of the organisation
in which they belong.

*JIRA tickets*: [BB-3622](https://tasks.opencraft.com/browse/BB-3622)

~*Discussions*: Link to any public dicussions about this PR or the design/architecture. Otherwise omit this.~

*Dependencies*: None

*Screenshots*:
![image](https://user-images.githubusercontent.com/7670449/108390150-61d3c100-7236-11eb-914c-efb1b8781425.png)

~*Sandbox URL*: TBD - sandbox is being provisioned.~

~*Merge deadline*: "None" if there's no rush, "ASAP" if it's critical, or provide a specific date if there is one.~

*Testing instructions*:

1. Get the devstack up and running
2. Pull this branch in edx-platform
3. Make sure to run the migration
3. ~Drop in the studio shell `make dev.shell.studio`~
4. vim /edx/etc/studio.yml and set ENABLE_CREATOR_GROUP = True
The below changes are also required to be done
```
diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py
index 9d610b31f0..b548167a35 100644
— a/cms/envs/devstack.py
+++ b/cms/envs/devstack.py
@@ -152,7 +152,7 @@ CREDENTIALS_SERVICE_USERNAME = 'credentials_worker'
FEATURES['CERTIFICATES_HTML_VIEW'] = True

########################## AUTHOR PERMISSION #######################
-FEATURES['ENABLE_CREATOR_GROUP'] = False
+FEATURES['ENABLE_CREATOR_GROUP'] = True

  1.  

    1.  

      1.  

        1.  

          1.  

            1.  

              1.  

                1.  

                  1.  

                    1.  

                      1.  

                        1.  

                          1.  

                            1.  

                              1.  

                                1.  

                                  1.  

                                    1.  

                                      1. FRONTEND APPLICATION PUBLISHER URL ###################
                                        FEATURES['FRONTEND_APP_PUBLISHER_URL'] = 'http://localhost:18400'
                                        diff --git a/cms/envs/devstack_decentralized.py b/cms/envs/devstack_decentralized.py
                                        index f7d61d41a1..f115c9e56a 100644

      • a/cms/envs/devstack_decentralized.py
        +++ b/cms/envs/devstack_decentralized.py
        @@ -107,7 +107,7 @@ CREDENTIALS_SERVICE_USERNAME = 'credentials_worker'
        FEATURES['CERTIFICATES_HTML_VIEW'] = True


########################## AUTHOR PERMISSION #######################
-FEATURES['ENABLE_CREATOR_GROUP'] = False
+FEATURES['ENABLE_CREATOR_GROUP'] = True

  1.  

    1.  

      1.  

        1.  

          1.  

            1.  

              1.  

                1.  

                  1.  

                    1.  

                      1.  

                        1.  

                          1.  

                            1.  

                              1.  

                                1.  

                                  1.  

                                    1.  

                                      1. FRONTEND APPLICATION PUBLISHER URL ###################
                                        FEATURES['FRONTEND_APP_PUBLISHER_URL'] = 'http://localhost:18400'
                                        ```

5. ~In the `FEATURES` dictionary add `RESTRICT_NON_ORG_COURSE_CREATION: true`~
6. Now create a user
7. ~Go to the `admin` page and in localhost:18010/admin/student/courseaccessrole/ create a new entry, add the user, give it instructor privilege, don't add the `Org` yet~
8. Log in the studio and request for permission to create the course
9. Log in with a user who is a staff and superuser in another browser
10. Go to http://localhost:18010/admin/course_creators/coursecreator/
11. Here you can see the permission, all_organization and organization field
10. If you enable all_organzitaions field it will create a CourseCreator Role and works accordingly
11. If you disable all_organization field then you need to add Organizations, this will create OrganiztionContentCreator Role, if you create this role
12. Then you can try creating a course and in the Org field you need to enter org short name, this is case sensitive field and it will create the course
13. If any other Org is entered, it will not create the course and will through error

*Author notes and concerns*:

1. It's a in discovery feature

*Reviewers*

  • [ ] @lgp171188

Assignee

Kyle McCormick

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Farhaan Bukhsh

Repo

edx/edx-platform

Customer

Epic Link

None

OSCM Assignee

None

Platform Map Area (Levels 1 & 2)

None

Platform Map Area (Levels 3 & 4)

None

Blended Hour Utilization Percentage

None

edX Theme

None

edX Squad

None

Github Lines Added

170

Github Lines Deleted

16

Priority

Unset