General help

 
 
Brum Brum
My Moodle: Override permissions on 'my moodle' sticky blocks?
 
I want to set up some override permissions on some of my 'my moodle' sticky blocks; there isn't an assign roles icon to click. Is there a way to do this?


Thanks,
Mike
 
Average of ratings: -
Picture of John White
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Mike,

I'm certain this is intentional, perhaps because the concept of changing the permissions within My Moodle is an irrelevance because My Moodle is intended to deliver to the user only what is appropriate to that user.

Maybe there is a workaround for what you are trying to achieve - do you want to give more detail?

Regards,

John
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
I've written a new block that lists people with a certian role. I want to put 2 instances (1 listing teachers, the other listing students) on my moodle as sticky blocks; I'd like the student list block to only be availible to staff and the techer list block to only be availible to management staff. I was planning to just put override permissions so that only these people have the capability to use these instances of the block.

I want the permissions to generally be individually configurable as teachers can use it in their own courses and may want students to use the lists etc.

Thanks,
Mike
 
Average of ratings: -
Picture of John White
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Mike,

The first part of your requirements might not be too difficult to achieve. You may have created your blocks by cloning /block/participants/block_participants.php, in which case the ability to mask the content (though perhaps not the whole block) is already there.
You see...

if ($COURSE->id == SITEID) {
if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
$this->content = '';
return $this->content;
}
} else {
if (!has_capability('moodle/course:viewparticipants', $currentcontext)) {
$this->content = '';
return $this->content;
}
}

and perhaps this could be left as it is for the Students block, but for the Teacher list become...


if ($COURSE->id == SITEID) {
if (!has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_SYSTEM))) {
$this->content = '';
return $this->content;
}
} else {
if (!has_capability('moodle/course:viewparticipants', $currentcontext)) {
$this->content = '';
return $this->content;
}
}

I have chosen a capability that is set to allow for Teachers, but generally not for Students (there may be other more appropriate choices).

Notice that the Context for mymoodle is the Site Context not a course context.
Making the entire block invisible is very much more difficult because the blocks are visible or hidden in the database, and the page building for My Moodle relies on generic page and block building burried well down in the layers of code (so you might make changes that would effect ALL types of blocks - in all situations!)


As for the second part, the individually configurable blocks - I wouldn't even attempt this! Because My Moodle is a Site Context, not a Course Context, the fact that one teacher wants a list and another doesn't is irrelevant to My Moodle. If one teacher could configure what a student sees in my moodle, then another teacher might not want that, so how could that work? Perhaps there is a misconception about what My Moodle is for. Once the user enters into a course, the Course Context takes over and staff have the ability to add in blocks (and your new blocks can be made to appear in the list). But if the administrator adds a Sticky block to the course page, then, as with My Moodle, this can't be configured in the course. Otherwise there would be little point in the sticky block notion.

Does that help?

Regards,

John
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Having separate capability checks is something I was using when I had two independant (but very similar) blocks. Now I have two instances of the same block, each of which is configurable- one set to list teachers the other students. As it is the same code the only way I could work that is to somehow have the capability system find a list of all the roles and create a capability for each (block/quickfindlist:adminview, block/quickfindlist:teacherview, block/quickfindlist:studentview etc.).

I think I've explained the second part badly- I want all the instances of my quickfindlist block to be individually configurable with override permissions. These will either be set up by me or be in courses set up by teachers. I am aware that everyone only configures their own my moodle and that only I (via sticky blocks, or logging in as) can change anyone elses- I just want to avoid doing all of them manually

Thanks,
Mike
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Is there really no way to do this?

Thanks,
Mike
 
Average of ratings: -
Picture of John White
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Mike,

Unless someone else come in with a solution, I think not! Except that you could simply reappraise your approach as follows...

Firstly we have established that this is not a My Moodle issue, that you want to see configurable block IN COURSES.
You have been able to configure a block that lists students, and a block that lists teachers. You can of course have a block that lists students AND teachers of the course that block is displayed in (since you just filter on that course id).
Until now you have added these blocks as sticky blocks to courses, if you added them to My Moodle as sticky blocks they could not filter on course id (and as I understand it you want to show who is available from those on a course).

Now, present ALL THREE types of special blocks as available in the 'blocks' dropdown and let the course leader choose which, if any, to add to the course. You give them the blocks and the information and they decide.
If you make the Teacher-list block content only viewable to Teachers (or above) but the Student AND Teachers -list block content viewable by students (as described previously), then there would be no need to make the permissions on the list configurable - staff simply choose which block they want!

Hope that sorts the problem.

Regards,

John


BTW Can I add one little rider. Since you have enabled MyMoodle you should also consider what additional consequences this brings. For one thing, the Student user (or any user logged in) can configure mymoodle to match their needs and wants - that's the point of it.
But this means that the user can add blocks from the list available to ALL in my moodle, including the "Online Users" block - where he/she can see every registered user as they log into the site.

 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
It seems I've not explained myself very well:

Wanting it to be availible for teachers to put in their courses and configure is separate to the my moodle issue which is something i want to apply globally. If they are used within a course they will show only people on that course, but on my moodle (or frontpage) will display anyopne with that role anywhere.

An early version of my block required 2 separate blocks for student/teacher; my shiny new version only exists once in code and each instance can be configured to a different role. This is why I cannot set permissions differently for the different blocks.

I don't want to hide it for security, but so that people don't have their screens cluttered with uneccesary stuff; if they want to see lists of everyone they are welcome to (anything I don't want them seeing is protected via permissions)

Thanks,
Mike
 
Average of ratings: -
Picture of John White
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
So, in your ideal world, what becomes of the Online Users block?

Doesn't that make the whole thing redundant? Or do you use capabilities to limit student use of that first?

I agree that lots of different blocks would create clutter!
But this problem is an uphill struggle because when you generate a sticky block in my moodle or in all courses, you obviate the need (or expectation) for local role assignment by virtue of its stickiness.
In turn, if you hacked it so that the Role Assign button DID appear on the sticky block, I have a nasty feeling that an even bigger hack would be required to make the block respond to such assignments. Because the block say 'am I sticky? okay, you get me!'.
Perhaps it is better to attempt to get an agreed position across the staff body, that might be less effort!


On one occasions I re-wrote the censorship filter (called censor.php), and walked straight into a wrangle about the best means to curb errant behave - which is not, of itself, censorship.
I'm not sure that this isn't related. Does it matter if a teacher is seen 'on-line'? Is there not an equal (potential) problem if students see each other on-line. Isn't this really a matter of engendering respect for the individual?
If it does matter then my question about the online users block is critical.

I don't think I've been of much help here.

Anyone else got a comment?

Regards,

John
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
I'm happy to leave the online users block as it is. I see the online users block as having 2 main effects: 1.people will be encouraged to message each other in real time, 2.if they are used to seeing a fair few names in the block they will subconciously see moodle as something others do and are more likely to keep using it.

My quickfindlist has a different purpose: people often need to be looked up (for exxample student liason officers were attaching notes to students earlier) this is the sort of thing that the block is useful for.

Hacking this seems like it would be a bad idea- is there no clever work around other than individually putting it on people's my moodle then?

Thanks,
Mike
 
Average of ratings: -
I'm Gumby, Dawmit!
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Mike, because I think you're a cool guy (and you're working on the abduction option for me), I'll put my two cents in here, even if doing so will probably reveal to the world that I haven't a clue what I'm talking about *lol*

But - For courses, what about adding the blocks as default in config.php? (then run resetblocks.php) That way you get around the sticky block issue, but the blocks will be present as in sticky blocks. Then teachers could simply hide from students (or delete) what they don't want and still be able to configure the blocks they do want.

That doesn't address the blocks on My Moodle, but as John noted individuals can add them as they wish to their personal page.

Now - maybe off topic just a bit - I would like to see a course block that shows all online users relative to that user regardless of where they are on the site.

In other words - A student is in Class A, one of her teachers is in Class B. This block would make that teacher visable to the student no matter what course the student is in. Yes, the student can see the teacher from Online Users in My Moodle, but once the student goes to a class, the teacher no longer is visable.

We're a self-paced K-12 online-only school. Teachers have several subjects in several grades and obviously can't be in more than one class at a time (unless we had a block like this... ). Actually, (and probably easier), even a block that showed all online teachers/students regardless of relation would be a big plus, as we don't have allot of users online at the same time.

This isn't by chance a function in the blocks you're working on, it it? smile
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Sorry, I've still not managed to explain myself properly. I want to have it on peoples my moodles. For courses I only want the option for teachers to put it on themself (but not to have it there by default)

As far as tweaking the online users block it'll just be a case of a different sql query. I'll have a look at it later (sounds like it would be useful to me as well)

Mike
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Find attached a new online_users block; it's not perfect as it doesn't support groups in the new mode and can only pick up people with a role defined in the current course (no system/category roles or non-role-carrying visitors), but is better than the original.

You'll have to go into the settings and turn the new mode on; then it will display in this new mode on course pages (while still showing everyone on front/my page)

Mike
 
Average of ratings: -
I'm Gumby, Dawmit!
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 

I see. Just having the block installed makes it available for teachers in courses, I suppose, but it looks like for My Moodle, it's either stuck as static or they have to add it from drop down. However, if there's a way around that, I'm sure you'll find it!

The online block you attached, but seems to have since disappeared big grin- that is a pretty good idea, huh? (unless you have a gazillion online users). You're so quick to come up with stuff!

I probably will drop the regular online users block - that is - if you wouldn't mind attaching it again?...*lol*

 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Here you go. It's not a new block, it's just an upgrade to the old block- there is a setting that changes it from working like it used to, to showing all course members who are logged in anywhere

Mike

P.S. If a mod removed it intentionally, let me know and I'll not re-upload it
 
Average of ratings: -
Picture of John White
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Mike,

Does this mean that you have now resolved all your earlier issues, or have you solved the functionality issues but not the deployment ones?

If the latter is the case, can you recap on exactly what behaviour you want to see? I got lost somewhere!

John
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
No, I've still not solved the original problem:

I've written a block that displays a searchable list of users according to their role (the specific role is configured for each instance). I want an instance of this block set to list students to show up on 'my moodle' for student liason officers, A different instance listing teachers to show for HOD and management staff.

I used to do this by having 2 separate blocks with the roles hardcoded and then bodged permissions checks. I don't want to have my new block work like this for two reasons: roles are not a constant- to have a canviewteacherlist and canviewstudentlist capabilities will therefore not work properly as extra capibilities will need to be invented/deleted whenever roles are changed(even more headaches if they are renamed), and it will restrict usage on course pages by teachers.

I was thinking that I could simply put override permissions on the my moodle instances but this can't be done.

Thanks,
Mike
 
Average of ratings: -
Brum Brum
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Don't use that one^, I managed to hard code the time 5 mins before when I started working into it, rather than a proper '5 minutes ago'. I've corrected this and simplified the query in this new version
 
Average of ratings: -
I'm Gumby, Dawmit!
Re: My Moodle: Override permissions on 'my moodle' sticky blocks?
 
Very cool. This would simply replace the regular, default online users block, correct?


In trying to understand your original goal better:

1) You can assign roles to your new, single block.

2) You want it to display as default on My Moodle page.

3) The only obvisious way to have 'default' blocks on My Moodle is to assign them sticky,

4) Sticky blocks can't be configured or have roles assigned.

5) If you could set the new block as a My Moodle default block (not sticky), your problem would be solved...


Is that right? Am I close?
 
Average of ratings: -