Refactoring code

revert-70aa11f8
Megala 8 years ago
parent d9ec203727
commit 4a71be850c

@ -174,7 +174,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName, @PathParam("roleName") String roleName,
@ApiParam( @ApiParam(
name = "user-store", name = "user-store",
value = "The name of the UserStore you wish to get the list of roles.", value = "The name of the user store from which you wish to get the permission of role.",
required = false) required = false)
@QueryParam("user-store") String userStoreName, @QueryParam("user-store") String userStoreName,
@ApiParam( @ApiParam(
@ -244,7 +244,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName, @PathParam("roleName") String roleName,
@ApiParam( @ApiParam(
name = "user-store", name = "user-store",
value = "The name of the UserStore you wish to get the list of roles.", value = "The name of the user store which the particular of role resides in",
required = false) required = false)
@QueryParam("user-store") String userStoreName, @QueryParam("user-store") String userStoreName,
@ApiParam( @ApiParam(
@ -368,7 +368,7 @@ public interface RoleManagementService {
required = true) RoleInfo role, required = true) RoleInfo role,
@ApiParam( @ApiParam(
name = "user-store", name = "user-store",
value = "The name of the UserStore you wish to get the list of roles.", value = "The name of the user store which the particular role resides in.",
required = false) required = false)
@QueryParam("user-store") String userStoreName); @QueryParam("user-store") String userStoreName);
@ -407,7 +407,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName, @PathParam("roleName") String roleName,
@ApiParam( @ApiParam(
name = "user-store", name = "user-store",
value = "The name of the UserStore you wish to get the list of roles.", value = "The name of the user store which the particular role resides in.",
required = false) required = false)
@QueryParam("user-store") String userStoreName); @QueryParam("user-store") String userStoreName);
@ -471,7 +471,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName, @PathParam("roleName") String roleName,
@ApiParam( @ApiParam(
name = "user-store", name = "user-store",
value = "The name of the UserStore you wish to get the list of roles.", value = "The name of the user store which the particular role resides in.",
required = false) required = false)
@QueryParam("user-store") String userStoreName, @QueryParam("user-store") String userStoreName,
@ApiParam( @ApiParam(

@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.opensaml.ws.wstrust.Primary;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;

@ -94,7 +94,8 @@
data-error-msg="{{roleNameRegExViolationErrorMsg}}" class="form-control" /> data-error-msg="{{roleNameRegExViolationErrorMsg}}" class="form-control" />
<span class="roleNameError hidden glyphicon glyphicon-remove form-control-feedback"></span> <span class="roleNameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error roleNameEmpty hidden" for="summary"> <label class="error roleNameEmpty hidden" for="summary">
Role name is required, should be in minimum 3 characters long and not include any whitespaces. Role name is required, should be in minimum 3 characters long and not include any
whitespaces or "@" character or "/" character.
</label> </label>
</div> </div>
{{#if canViewUsers}} {{#if canViewUsers}}

@ -83,7 +83,8 @@ clearInline["role-name"] = function () {
*/ */
validateInline["role-name"] = function () { validateInline["role-name"] = function () {
var roleNameInput = $("input#roleName"); var roleNameInput = $("input#roleName");
if (inputIsValid( roleNameInput.data("regex"), roleNameInput.val())) { if (inputIsValid( roleNameInput.data("regex"), roleNameInput.val()) && roleNameInput.indexOf("@") < 0 &&
roleNameInput.indexOf("/") < 0) {
disableInlineError("roleNameField", "roleNameEmpty", "roleNameError"); disableInlineError("roleNameField", "roleNameEmpty", "roleNameError");
} else { } else {
enableInlineError("roleNameField", "roleNameEmpty", "roleNameError"); enableInlineError("roleNameField", "roleNameEmpty", "roleNameError");
@ -114,7 +115,6 @@ function formatRepoSelection (user) {
$(document).ready(function () { $(document).ready(function () {
var appContext = $("#app-context").data("app-context"); var appContext = $("#app-context").data("app-context");
$("#users").select2({ $("#users").select2({
multiple:true, multiple:true,
tags: false, tags: false,
@ -204,7 +204,8 @@ $(document).ready(function () {
$("input#roleName").val(""); $("input#roleName").val("");
$("#domain").val("PRIMARY"); $("#domain").val("PRIMARY");
$("#users").val(""); $("#users").val("");
window.location.href = appContext + "/role/edit-permission/?rolename=" + encodeURIComponent(addRoleFormData.roleName); window.location.href = appContext + "/role/edit-permission/?rolename=" +
encodeURIComponent(addRoleFormData.roleName);
} }
}, },
function (jqXHR) { function (jqXHR) {

@ -218,10 +218,9 @@ $("#role-grid").on("click", ".remove-role-link", function () {
removeRoleAPI, removeRoleAPI,
function () { function () {
if (userStore) { if (userStore) {
$("#role-" + userStore + "\\/" + role).remove(); role = userStore + '/' + role;
} else {
$("#role-" + role).remove();
} }
$('[id=role-' + role + ']').remove();
$(modalPopupContent).html($('#remove-role-success-content').html()); $(modalPopupContent).html($('#remove-role-success-content').html());
$("a#remove-role-success-link").click(function () { $("a#remove-role-success-link").click(function () {
hidePopup(); hidePopup();

@ -218,10 +218,9 @@ function removeUser(username) {
function (data, textStatus, jqXHR) { function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) { if (jqXHR.status == 200) {
if (domain) { if (domain) {
$("#user-" + domain + "\\/" + username).remove(); username = domain + '/' + username;
} else {
$("#user-" + username).remove();
} }
$('[id=user-' + username + ']').remove();
// update modal-content with success message // update modal-content with success message
modalDialog.header("User Removed."); modalDialog.header("User Removed.");
modalDialog.content("Done. User was successfully removed."); modalDialog.content("Done. User was successfully removed.");

Loading…
Cancel
Save