Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-793

Access control for courses

    XMLWordPrintable

    Details

      Description

      Something to discuss:
      Courses can be protected against unauthorized access by two methods: access code and the password protection from BPS.

      This confuses the users (authors). They don't know which method to use, they ask which one they should use and in the worst case they use both methods

      In my opinion, the password protection has no advantage against the access code. But there can be scenarios where the password protection is useful on structure elements. So I thought about a solution to hide the password protection from root elements and display it on subsequent structure elements. It leaves password protected root elements untouched when they are already configured with password protection.

      It works fine for us, so I think about rolling it out with OO 9.

      Here's the patch:
      diff -r dfce0100e6fa src/main/java/org/olat/course/condition/ConditionEditController.java
      — a/src/main/java/org/olat/course/condition/ConditionEditController.java Thu Sep 05 13:12:23 2013 +0200
      +++ b/src/main/java/org/olat/course/condition/ConditionEditController.java Wed Sep 25 13:35:25 2013 +0200
      @@ -130,6 +130,7 @@
      // <OLATCE-91>
      CourseEditorEnv courseEnv = euce.getCourseEditorEnv();
      CourseNode courseNode = courseEnv.getNode(courseEnv.getCurrentCourseNodeId());
      + boolean isRootNode = courseEnv.getRootNodeId().equals(courseNode.getIdent());
      if(showPasswordAccess && courseNode instanceof AbstractAccessableCourseNode){
      AbstractAccessableCourseNode accessableCourseNode = (AbstractAccessableCourseNode)courseNode;
      for(AdditionalCondition addCond : accessableCourseNode.getAdditionalConditions())

      { @@ -137,12 +138,21 @@ passwordCondition = (PasswordCondition) addCond; }

      }

      • if(passwordCondition == null) {
        + if ((passwordCondition == null) && (!isRootNode)) { passwordCondition = new PasswordCondition(); accessableCourseNode.getAdditionalConditions().add(passwordCondition); }
      • passwordConditionEditController = passwordCondition.getEditorComponent(ureq, wControl);
      • listenTo(passwordConditionEditController);
        + if ((passwordCondition != null) && (isRootNode))
        Unknown macro: {+ String pass = passwordCondition.getPassword();+ if ((pass == null) || (pass.length() == 0)) { + accessableCourseNode.getAdditionalConditions().remove(passwordCondition); + passwordCondition = null; + }+ }

        + if (passwordCondition != null)

        { + passwordConditionEditController = passwordCondition.getEditorComponent(ureq, wControl); + listenTo(passwordConditionEditController); + }

        }
        // </OLATCE-91>

      diff -r dfce0100e6fa src/main/java/org/olat/course/editor/CourseEditorEnv.java
      — a/src/main/java/org/olat/course/editor/CourseEditorEnv.java Thu Sep 05 13:12:23 2013 +0200
      +++ b/src/main/java/org/olat/course/editor/CourseEditorEnv.java Wed Sep 25 13:35:25 2013 +0200
      @@ -177,5 +177,6 @@
      */
      public CourseNode getNode(String nodeId);
      // </OLATCE-91>
      + public String getRootNodeId();

      }
      diff -r dfce0100e6fa src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java
      — a/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java Thu Sep 05 13:12:23 2013 +0200
      +++ b/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java Wed Sep 25 13:35:25 2013 +0200
      @@ -492,6 +492,10 @@
      public CourseGroupManager getCourseGroupManager()

      { return cgm; }

      +
      + public String getRootNodeId()

      { + return cetm.getRootNode().getIdent(); + }

      }

        Attachments

          Activity

            People

            • Assignee:
              srosse Stéphane Rossé
              Reporter:
              stephan Stephan Clemenz
              Tester:
              Florian Gnägi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m