(refs #1286) Show group marker when collaborator is added

This commit is contained in:
Naoki Takezoe
2016-11-01 21:04:27 +09:00
parent 85d38a47f1
commit 83baaa6ed9
4 changed files with 28 additions and 31 deletions

View File

@@ -118,12 +118,13 @@ trait IndexControllerBase extends ControllerBase {
})
/**
* JSON API for checking user existence.
* JSON API for checking user or group existence.
* Returns a single string which is any of "group", "user" or "".
*/
post("/_user/existence")(usersOnly {
getAccountByUserName(params("userName")).map { account =>
if(params.get("userOnly").isDefined) !account.isGroupAccount else true
} getOrElse false
if(account.isGroupAccount) "group" else "user"
} getOrElse ""
})
// TODO Move to RepositoryViwerController?

View File

@@ -80,15 +80,14 @@ $(function(){
}
// check existence
$.post('@context.path/_user/existence', {
'userName': userName
}, function(data, status){
if(data == 'true'){
addMemberHTML(userName, false);
} else {
$('#error-members').text('User does not exist.');
}
});
$.post('@context.path/_user/existence', { 'userName': userName },
function(data, status){
if(data == 'user'){
addMemberHTML(userName, false);
} else {
$('#error-members').text('User does not exist.');
}
});
});
$(document).on('click', '.remove', function(){

View File

@@ -75,16 +75,14 @@ $(function(){
}
// check existence
$.post('@context.path/_user/existence', {
'userName': userName,
'userOnly': true
}, function(data, status){
if(data == 'true'){
addMemberHTML(userName, false);
} else {
$('#error-members').text('User does not exist.');
}
});
$.post('@context.path/_user/existence', { 'userName': userName },
function(data, status){
if(data == 'user'){
addMemberHTML(userName, false);
} else {
$('#error-members').text('User does not exist.');
}
});
});
$(document).on('click', '.remove', function(){

View File

@@ -48,15 +48,14 @@ $(function(){
}
// check existence
$.post('@context.path/_user/existence', {
'userName': userName
}, function(data, status){
if(data == 'true'){
addCollaboratorHTML(userName, '@Permission.ADMIN.name'); // TODO isGroup
} else {
$('#error-collaborators').text('User does not exist.');
}
});
$.post('@context.path/_user/existence', { 'userName': userName },
function(data, status){
if(data != ''){
addCollaboratorHTML(userName, '@Permission.ADMIN.name', data == 'group');
} else {
$('#error-collaborators').text('User does not exist.');
}
});
});
$(document).on('click', '.remove', function(){