Merge pull request #2778 from volodymyr-babak/fix-for-equals
Use equals instead of ==
This commit is contained in:
commit
2eeb11c781
@ -135,7 +135,7 @@ public class UserController extends BaseController {
|
|||||||
HttpServletRequest request) throws ThingsboardException {
|
HttpServletRequest request) throws ThingsboardException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (getCurrentUser().getAuthority() == Authority.TENANT_ADMIN) {
|
if (Authority.TENANT_ADMIN.equals(getCurrentUser().getAuthority())) {
|
||||||
user.setTenantId(getCurrentUser().getTenantId());
|
user.setTenantId(getCurrentUser().getTenantId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public class WidgetTypeController extends BaseController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public WidgetType saveWidgetType(@RequestBody WidgetType widgetType) throws ThingsboardException {
|
public WidgetType saveWidgetType(@RequestBody WidgetType widgetType) throws ThingsboardException {
|
||||||
try {
|
try {
|
||||||
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
|
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
|
||||||
widgetType.setTenantId(TenantId.SYS_TENANT_ID);
|
widgetType.setTenantId(TenantId.SYS_TENANT_ID);
|
||||||
} else {
|
} else {
|
||||||
widgetType.setTenantId(getCurrentUser().getTenantId());
|
widgetType.setTenantId(getCurrentUser().getTenantId());
|
||||||
|
|||||||
@ -61,7 +61,7 @@ public class WidgetsBundleController extends BaseController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public WidgetsBundle saveWidgetsBundle(@RequestBody WidgetsBundle widgetsBundle) throws ThingsboardException {
|
public WidgetsBundle saveWidgetsBundle(@RequestBody WidgetsBundle widgetsBundle) throws ThingsboardException {
|
||||||
try {
|
try {
|
||||||
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
|
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
|
||||||
widgetsBundle.setTenantId(TenantId.SYS_TENANT_ID);
|
widgetsBundle.setTenantId(TenantId.SYS_TENANT_ID);
|
||||||
} else {
|
} else {
|
||||||
widgetsBundle.setTenantId(getCurrentUser().getTenantId());
|
widgetsBundle.setTenantId(getCurrentUser().getTenantId());
|
||||||
@ -103,7 +103,7 @@ public class WidgetsBundleController extends BaseController {
|
|||||||
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
||||||
try {
|
try {
|
||||||
PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
|
PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
|
||||||
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
|
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
|
||||||
return checkNotNull(widgetsBundleService.findSystemWidgetsBundlesByPageLink(getTenantId(), pageLink));
|
return checkNotNull(widgetsBundleService.findSystemWidgetsBundlesByPageLink(getTenantId(), pageLink));
|
||||||
} else {
|
} else {
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
@ -119,7 +119,7 @@ public class WidgetsBundleController extends BaseController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<WidgetsBundle> getWidgetsBundles() throws ThingsboardException {
|
public List<WidgetsBundle> getWidgetsBundles() throws ThingsboardException {
|
||||||
try {
|
try {
|
||||||
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
|
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
|
||||||
return checkNotNull(widgetsBundleService.findSystemWidgetsBundles(getTenantId()));
|
return checkNotNull(widgetsBundleService.findSystemWidgetsBundles(getTenantId()));
|
||||||
} else {
|
} else {
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
|
|||||||
@ -105,7 +105,7 @@ public class CustomerUserPermissions extends AbstractPermissions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
|
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
|
||||||
if (userEntity.getAuthority() != Authority.CUSTOMER_USER) {
|
if (!Authority.CUSTOMER_USER.equals(userEntity.getAuthority())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!user.getId().equals(userId)) {
|
if (!user.getId().equals(userId)) {
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class SysAdminPermissions extends AbstractPermissions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
|
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
|
||||||
if (userEntity.getAuthority() == Authority.CUSTOMER_USER) {
|
if (Authority.CUSTOMER_USER.equals(userEntity.getAuthority())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public class TenantAdminPermissions extends AbstractPermissions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
|
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
|
||||||
if (userEntity.getAuthority() == Authority.SYS_ADMIN) {
|
if (Authority.SYS_ADMIN.equals(userEntity.getAuthority())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!user.getTenantId().equals(userEntity.getTenantId())) {
|
if (!user.getTenantId().equals(userEntity.getTenantId())) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user