Refactoring code

merge-requests/7/head
Megala 8 years ago
parent d9ec203727
commit 4a71be850c

@ -174,7 +174,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName,
@ApiParam(
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)
@QueryParam("user-store") String userStoreName,
@ApiParam(
@ -244,7 +244,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName,
@ApiParam(
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)
@QueryParam("user-store") String userStoreName,
@ApiParam(
@ -368,7 +368,7 @@ public interface RoleManagementService {
required = true) RoleInfo role,
@ApiParam(
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)
@QueryParam("user-store") String userStoreName);
@ -407,7 +407,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName,
@ApiParam(
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)
@QueryParam("user-store") String userStoreName);
@ -471,7 +471,7 @@ public interface RoleManagementService {
@PathParam("roleName") String roleName,
@ApiParam(
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)
@QueryParam("user-store") String userStoreName,
@ApiParam(

@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
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.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;

@ -94,7 +94,8 @@
data-error-msg="{{roleNameRegExViolationErrorMsg}}" class="form-control" />
<span class="roleNameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<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>
</div>
{{#if canViewUsers}}

@ -83,7 +83,8 @@ clearInline["role-name"] = function () {
*/
validateInline["role-name"] = function () {
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");
} else {
enableInlineError("roleNameField", "roleNameEmpty", "roleNameError");
@ -114,7 +115,6 @@ function formatRepoSelection (user) {
$(document).ready(function () {
var appContext = $("#app-context").data("app-context");
$("#users").select2({
multiple:true,
tags: false,
@ -204,7 +204,8 @@ $(document).ready(function () {
$("input#roleName").val("");
$("#domain").val("PRIMARY");
$("#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) {

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

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

Loading…
Cancel
Save