I have also made a userscript for this. I've added this feature to my SOX (Stack Overflow Extras) userscript in v1.0.3 (in the DEV branch currently).
Here's how it looks:
You can give users read or write access, or remove their read/write privileges by clicking 'no'.
You can install SOX easily by following the above link, and you can also enable a bunch of other useful optional features from the control panel :)
If you just want this as a separate userscript, here's the code:
// ==UserScript==
// @name Chat Access Adder
// @namespace http://stackexchange.com/users/4337810/
// @version 1.0
// @description A userscript that allows you to easily change user permissions in chat :)
// @author ᔕᖺᘎᕊ (http://stackexchange.com/users/4337810/)
// @match *://chat.stackoverfow.com/*
// @match *://chat.meta.stackexchange.com/*
// @match *://chat.stackexchange.com/*
// @grant none
// ==/UserScript==
new MutationObserver(function( mutations ) {
mutations.forEach(function( mutation ) {
var newNodes = mutation.addedNodes;
if(newNodes !== null) {
var $nodes = $(newNodes);
$nodes.each(function() {
var $node = $( this );
if($node.hasClass("user-popup")) {
setTimeout(function() {
var id = $node.find('a')[0].href.split('/')[4];
if($('.chatEasyAccess').length) {
$('.chatEasyAccess').remove();
}
$node.find('div:last-child').after('<div class="chatEasyAccess">give <b id="read-only">read</b> / <b id="read-write">write</b> / <b id="remove">no</b> access</div>');
$(document).on('click', '.chatEasyAccess b', function() {
$that = $(this);
$.ajax({
url: 'http://chat.stackexchange.com/rooms/setuseraccess/'+location.href.split('/')[4],
type: 'post',
data: {
'fkey': fkey().fkey,
'userAccess': $that.attr('id'),
'aclUserId': id
},
success: function(d) {
if(d=='') {
alert('Successfully changed user access');
} else {
alert(d);
}
}
});
});
}, 1000);
}
});
}
});
}).observe(document.getElementById('chat-body'), {
childList: true,
attributes: true
});