| Line 808... |
Line 808... |
| 808 |
res.put("created", previous == null);
|
808 |
res.put("created", previous == null);
|
| 809 |
return responseSender.ok(res);
|
809 |
return responseSender.ok(res);
|
| 810 |
}
|
810 |
}
|
| 811 |
|
811 |
|
| 812 |
/**
|
812 |
/**
|
| 813 |
* Who may create leads from the LMS dashboard: FOFO admins, or anyone holding a position (any
|
813 |
* Who may create leads from the LMS dashboard: anyone holding a position (any category) at L2
|
| - |
|
814 |
* or above. The position decides -- an L1 agent is refused even with FOFO_ADMIN on the login.
|
| - |
|
815 |
* Only a user with no position at all falls back to the admin role. Mirrors the
|
| 814 |
* category) at L2 or above. Mirrors the {@code canCreateLead} flag that hides the tab.
|
816 |
* {@code canCreateLead} flag that hides the tab.
|
| 815 |
*/
|
817 |
*/
|
| 816 |
private boolean canCreateLeads(HttpServletRequest request, AuthUser me) {
|
818 |
private boolean canCreateLeads(HttpServletRequest request, AuthUser me) {
|
| 817 |
try {
|
- |
|
| 818 |
LoginDetails login = cookiesProcessor.getCookiesObject(request);
|
- |
|
| 819 |
if (login != null && login.getRoleIds() != null && roleManager.isAdmin(login.getRoleIds())) {
|
- |
|
| 820 |
return true;
|
- |
|
| 821 |
}
|
- |
|
| 822 |
} catch (Exception e) {
|
- |
|
| 823 |
LOGGER.warn("Could not read roles for auth {}", me.getId(), e);
|
- |
|
| 824 |
}
|
- |
|
| 825 |
List<Position> held = positionRepository.selectPositionByAuthId(me.getId());
|
819 |
List<Position> held = positionRepository.selectPositionByAuthId(me.getId());
|
| 826 |
if (held != null) {
|
820 |
if (held != null && !held.isEmpty()) {
|
| 827 |
for (Position p : held) {
|
821 |
for (Position p : held) {
|
| 828 |
if (p.getEscalationType() != null && p.getEscalationType().ordinal() >= EscalationType.L2.ordinal()) {
|
822 |
if (p.getEscalationType() != null && p.getEscalationType().ordinal() >= EscalationType.L2.ordinal()) {
|
| 829 |
return true;
|
823 |
return true;
|
| 830 |
}
|
824 |
}
|
| 831 |
}
|
825 |
}
|
| - |
|
826 |
return false;
|
| - |
|
827 |
}
|
| - |
|
828 |
try {
|
| - |
|
829 |
LoginDetails login = cookiesProcessor.getCookiesObject(request);
|
| - |
|
830 |
return login != null && login.getRoleIds() != null && roleManager.isAdmin(login.getRoleIds());
|
| - |
|
831 |
} catch (Exception e) {
|
| - |
|
832 |
LOGGER.warn("Could not read roles for auth {}", me.getId(), e);
|
| - |
|
833 |
return false;
|
| 832 |
}
|
834 |
}
|
| 833 |
return false;
|
- |
|
| 834 |
}
|
835 |
}
|
| 835 |
|
836 |
|
| 836 |
/** FOFO admin, the "Sales Admin" role, or a Sales position at L5 or above. */
|
837 |
/** FOFO admin, the "Sales Admin" role, or a Sales position at L5 or above. */
|
| 837 |
private boolean canManageRegionOwners(HttpServletRequest request, AuthUser me) {
|
838 |
private boolean canManageRegionOwners(HttpServletRequest request, AuthUser me) {
|
| 838 |
try {
|
839 |
try {
|