use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Security method getUserInfo.
@Util
public static UserInfo getUserInfo() {
String key = getUserInfoCacheKey();
UserInfo user = (UserInfo) Cache.get(key);
if (user == null) {
user = new UserInfo(getViprClient().getUserInfo());
Cache.set(key, user, CACHE_EXPR);
}
return user;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Tenants method deleteRoleAssignments.
@Util
private static void deleteRoleAssignments(String[] ids) {
if (ids != null && ids.length > 0) {
boolean deletedRoleAssignment = false;
for (String id : ids) {
String name = TenantRoleAssignmentForm.extractNameFromId(id);
RoleAssignmentType type = TenantRoleAssignmentForm.extractTypeFromId(id);
String tenantId = TenantRoleAssignmentForm.extractTenantFromId(id);
if (RoleAssignmentUtils.isRootUser(type, name)) {
flash.put("warningMessage", MessagesUtils.get("roleAssignments.rootNotDeleted"));
} else {
deleteTenantRoleAssignment(tenantId, type, name);
deletedRoleAssignment = true;
}
}
if (deletedRoleAssignment) {
flash.success(MessagesUtils.get("roleAssignments.deleted"));
}
}
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Models method currentAdminTenant.
@Util
public static String currentAdminTenant() {
String sessionTenant = session.get(TENANT_ID);
if (sessionTenant != null && canSelectTenant(sessionTenant)) {
return validateSessionTenant(sessionTenant);
} else {
session.remove(TENANT_ID);
UserInfo info = Security.getUserInfo();
if (Security.isTenantAdmin() && !Security.isHomeTenantAdmin()) {
for (URI tenant : info.getSubTenants()) {
String tenantId = tenant.toString();
if (info.hasSubTenantRole(tenantId, Security.TENANT_ADMIN)) {
return tenantId;
}
}
}
// fallback to the home tenant if nothing else matches
return info.getTenant();
}
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Models method currentAdminTenantForVcenter.
@Util
public static String currentAdminTenantForVcenter() {
String sessionTenant = session.get(TENANT_ID);
if (sessionTenant != null && canSelectTenantForVcenters(sessionTenant)) {
return validateSessionTenantForVcenter(sessionTenant);
} else {
session.remove(TENANT_ID);
UserInfo info = Security.getUserInfo();
if (Security.isTenantAdmin() && !Security.isHomeTenantAdmin()) {
for (URI tenant : info.getSubTenants()) {
String tenantId = tenant.toString();
if (info.hasSubTenantRole(tenantId, Security.TENANT_ADMIN)) {
return tenantId;
}
}
}
// fallback to the home tenant if nothing else matches
return info.getTenant();
}
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class ExecutionWindows method isOverlapping.
@Util
public static boolean isOverlapping(ExecutionWindowForm executionWindowForm) {
if (executionWindowForm.length == null) {
return false;
}
ExecutionWindowRestRep tempExecutionWindow = new ExecutionWindowRestRep();
tempExecutionWindow.setName(Messages.get("ExecutionWindows.tempWindowLabel"));
executionWindowForm.writeTo(tempExecutionWindow);
return ExecutionWindowUtils.isOverlapping(tempExecutionWindow);
}
Aggregations