Moodle
  1. Moodle
  2. MDL-31105

Upload a single file assignment, admins switched to students cannot upload a file as the button is not present

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.7, 2.1, 2.2
    • Fix Version/s: None
    • Component/s: Assignment (2.2)
    • Labels:
      None
    • Environment:
      LAMP
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1. Create a Upload a single file assignment in a course
      2. Access this Assignment as an administrator.
      3. View that the "Upload" button is not visible to any user.
      4. Switch role to student, and access the assignment. View that the "Upload" button is not visible.
      5. Login as a student enrolled in the course. View that the "Upload button is visible.

      Show
      1. Create a Upload a single file assignment in a course 2. Access this Assignment as an administrator. 3. View that the "Upload" button is not visible to any user. 4. Switch role to student, and access the assignment. View that the "Upload" button is not visible. 5. Login as a student enrolled in the course. View that the "Upload button is visible.
    • Workaround:
      Hide

      You need to be enrolled in the course. Having a role with capabilities is not enough to submit an assignment. Make sure any user that has to submit an assignment is also enrolled.

      Show
      You need to be enrolled in the course. Having a role with capabilities is not enough to submit an assignment. Make sure any user that has to submit an assignment is also enrolled.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Rank:
      37533

      Description

      http://tracker.moodle.org/browse/MDLQA-1246

      I found the QA tracker that has tested the functionality in 2.0, 2.1, and 2.2, but I have not been unable to create a Single File Upload Assignment on our servers that allows for a user to upload an Assignment. The button is just not there. I was curious if this was our server setup as it appears this is not happening for other Moodle users. I viewed the source code, in hopes that it just might be a corrupt installation, for "<input type="submit" value="Upload a file">" but this code is not even present. I then checked the creation of this assignment on 4 production sites and a clean installation on our servers and all are missing the upload button when the assignment is created.

      I can provide the code from our git repos if it will help resolve what might be happening on our servers but I am, at this point, at a loss.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Hi, Joseph.

          I checked and I am able to do this on my own test server and on qa.moodle.net.

          It might be worth checking where your code differs from the current git versions and what could be causing this problem. There would not be explicit HTML with an input tag; it would be handled by a button renderer.

          Show
          Michael de Raadt added a comment - Hi, Joseph. I checked and I am able to do this on my own test server and on qa.moodle.net. It might be worth checking where your code differs from the current git versions and what could be causing this problem. There would not be explicit HTML with an input tag; it would be handled by a button renderer.
          Hide
          Joseph Jacelone added a comment - - edited

          Hey Michael,

          Thanks for the reply. I will check the difference between our code and the current code in the public repos. I figured there would not be an explicit HTML string as the majority of Moodle is built on php. I will hunt down that render button string to see if it is missing or there is a conflict on how it is being created on our servers.

          Thanks again for all your help!

          Show
          Joseph Jacelone added a comment - - edited Hey Michael, Thanks for the reply. I will check the difference between our code and the current code in the public repos. I figured there would not be an explicit HTML string as the majority of Moodle is built on php. I will hunt down that render button string to see if it is missing or there is a conflict on how it is being created on our servers. Thanks again for all your help!
          Hide
          Michael de Raadt added a comment -

          Hi, Joseph.

          I'm closing this issue. If you do come across a problem that we may be able to help with, please launch a new issue.

          Show
          Michael de Raadt added a comment - Hi, Joseph. I'm closing this issue. If you do come across a problem that we may be able to help with, please launch a new issue.
          Hide
          Joseph Jacelone added a comment -

          Hey Michael,

          Will do. Thank you again!

          Show
          Joseph Jacelone added a comment - Hey Michael, Will do. Thank you again!
          Hide
          Mike Churchward added a comment -

          Settings and submissions page showing no submit button.

          Show
          Mike Churchward added a comment - Settings and submissions page showing no submit button.
          Hide
          Mike Churchward added a comment -

          Can you re-open this? I am seeing the same problem on a standard checkout from Moodle. Is this a problem with settings?

          Show
          Mike Churchward added a comment - Can you re-open this? I am seeing the same problem on a standard checkout from Moodle. Is this a problem with settings?
          Hide
          Mike Churchward added a comment -

          Further checking, there is something odd with privileges and that assignment type... If I access the assignment as an "admin", I cannot see the upload button, even though I have submit permissions. If use the "Switch role to" button, I likewise cannot see the button. If I access the activity as a student, I can see it. This can't be right.
          Please re-open.

          Show
          Mike Churchward added a comment - Further checking, there is something odd with privileges and that assignment type... If I access the assignment as an "admin", I cannot see the upload button, even though I have submit permissions. If use the "Switch role to" button, I likewise cannot see the button. If I access the activity as a student, I can see it. This can't be right. Please re-open.
          Hide
          Joseph Jacelone added a comment -

          I have also produced the same results as Mike.

          1] Login as admin
          2] Create an "Upload a single file" assignment in a course.
          3] Access the assignment while logged in as the admin [view no button]
          4] Use "Switch role to..." and switch to student then access the assignment [view no button]
          5] Log out
          6] Login as a student and access the assignment [button visible]

          Show
          Joseph Jacelone added a comment - I have also produced the same results as Mike. 1] Login as admin 2] Create an "Upload a single file" assignment in a course. 3] Access the assignment while logged in as the admin [view no button] 4] Use "Switch role to..." and switch to student then access the assignment [view no button] 5] Log out 6] Login as a student and access the assignment [button visible]
          Hide
          Michael de Raadt added a comment -

          Hi, all.

          I think the original suggestion that students cannot submit is not true. Students should be able to submit, but administrators might not be able to.

          I had a quick look at the code and what the assignment types are checking for before showing the form to submit an assignment. They are consistent in checking for the following.

          1. The user must be "enrolled" in the course (this is where admins are not seeing the form)
          2. The user must have the "mod/assignment:view" capability, which all base users have, except non-editing teachers

          If someone was the admin and not the teacher, they would not be able to submit or see the submit form.

          So what you are reporting is not a bug, but there are a couple of things we could possibly do.

          1. Nothing (prevent admins from submitting, they probably shouldn't any way);
          2. Continue to prevent admins from submitting, but display a message like "You cannot submit as you are a not an enrolled participant in this course"; or
          3. Allow admins to see the form and submit by adding a third check for is_admin().

          My preferred option would be the second.

          Show
          Michael de Raadt added a comment - Hi, all. I think the original suggestion that students cannot submit is not true. Students should be able to submit, but administrators might not be able to. I had a quick look at the code and what the assignment types are checking for before showing the form to submit an assignment. They are consistent in checking for the following. The user must be "enrolled" in the course (this is where admins are not seeing the form) The user must have the "mod/assignment:view" capability, which all base users have, except non-editing teachers If someone was the admin and not the teacher, they would not be able to submit or see the submit form. So what you are reporting is not a bug, but there are a couple of things we could possibly do. Nothing (prevent admins from submitting, they probably shouldn't any way); Continue to prevent admins from submitting, but display a message like "You cannot submit as you are a not an enrolled participant in this course"; or Allow admins to see the form and submit by adding a third check for is_admin(). My preferred option would be the second.
          Hide
          Mike Churchward added a comment - - edited
          1. So, is this the new rules for Moodle 2? Previously, submitting was determined by capabilities. If you could access the course, and had an assignment submit capability, then you could submit. Now, you also need to be enrolled in the course?
          2. This is inconsistent with other Moodle activities' behaviours. Forums and quizzes for example, allow an administrator to participate and submit without being enrolled in the course.
          3. The "Switch role to" function does not show the submit option when I switch to the student role. It does show that for both forum and quiz.

          In general, it looks like there is inconsistency in the rules around what needs to be set for a user to participate in a course activity. It would be best to generalize these rules, and then apply them consistently.

          Show
          Mike Churchward added a comment - - edited So, is this the new rules for Moodle 2? Previously, submitting was determined by capabilities. If you could access the course, and had an assignment submit capability, then you could submit. Now, you also need to be enrolled in the course? This is inconsistent with other Moodle activities' behaviours. Forums and quizzes for example, allow an administrator to participate and submit without being enrolled in the course. The "Switch role to" function does not show the submit option when I switch to the student role. It does show that for both forum and quiz. In general, it looks like there is inconsistency in the rules around what needs to be set for a user to participate in a course activity. It would be best to generalize these rules, and then apply them consistently.
          Hide
          Michael de Raadt added a comment -

          Hi, Mike.

          As far as I know this behaviour was present in 1.9. There is a capability check, but there is also a check of enrolment.

          You're correct that this behaviour does differ from other module types. I'm wondering what would happen if you simply took the is_enrolled check away. With the capability check tied to the context, that would normally be enough.

          Show
          Michael de Raadt added a comment - Hi, Mike. As far as I know this behaviour was present in 1.9. There is a capability check, but there is also a check of enrolment. You're correct that this behaviour does differ from other module types. I'm wondering what would happen if you simply took the is_enrolled check away. With the capability check tied to the context, that would normally be enough.
          Hide
          Evan Donovan added a comment -

          If the is_enrolled check was removed, could administrators/teachers then upload files if they wished? In our case, that would be good, at least so they could confirm visually that the course assignment was working properly, even if they did not have the capability to log in as one of their students to confirm.

          Show
          Evan Donovan added a comment - If the is_enrolled check was removed, could administrators/teachers then upload files if they wished? In our case, that would be good, at least so they could confirm visually that the course assignment was working properly, even if they did not have the capability to log in as one of their students to confirm.
          Hide
          Michael de Raadt added a comment -

          I believe that would be possible. Give it a go.

          Show
          Michael de Raadt added a comment - I believe that would be possible. Give it a go.
          Hide
          hk ra added a comment -

          Hi,

          Until yesterday, the upload button was in the course, and now I can't see the upload button in any of other courses.
          upload a single file was working for few weeks and the button keep disappears.

          So I tried signed in as student, switch role as student and both of trial didn't work.

          However, I created new course and new upload button shows.

          Any suggestion to fix this issue?

          This is my moodle information:
          Moodle 2.2 (Build: 20111205)

          Show
          hk ra added a comment - Hi, Until yesterday, the upload button was in the course, and now I can't see the upload button in any of other courses. upload a single file was working for few weeks and the button keep disappears. So I tried signed in as student, switch role as student and both of trial didn't work. However, I created new course and new upload button shows. Any suggestion to fix this issue? This is my moodle information: Moodle 2.2 (Build: 20111205)
          Hide
          hk ra added a comment -

          Also,
          if i don't have due date enable,
          upload button shows and it works.

          This is quick way to fix this for now...
          but it doesn't perm fix the problem

          Show
          hk ra added a comment - Also, if i don't have due date enable, upload button shows and it works. This is quick way to fix this for now... but it doesn't perm fix the problem
          Hide
          hk ra added a comment -

          So,,,I think this might have been issue to other people
          and I think its mistake that people make.
          When Available from setup is wrong and enabled, the up load button doesn't show up.
          So I just disabled "available from" setup and just have due date on and it works.

          I'm sorry if I took your time to read through this.

          Show
          hk ra added a comment - So,,,I think this might have been issue to other people and I think its mistake that people make. When Available from setup is wrong and enabled, the up load button doesn't show up. So I just disabled "available from" setup and just have due date on and it works. I'm sorry if I took your time to read through this.
          Hide
          Hélène Tremblay added a comment -

          I have the same problem. The students arent able to see the upload button in a teacher's course. I created a new assignment and the upload buttons was visible !!

          Show
          Hélène Tremblay added a comment - I have the same problem. The students arent able to see the upload button in a teacher's course. I created a new assignment and the upload buttons was visible !!

            People

            • Votes:
              6 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: