Search in sources :

Example 16 with UserInfo

use of org.usermanagement.model.UserInfo in project open-kilda by telstra.

the class UserActivityLogService method getActivityInfo.

/**
 * Gets the activity types and users info.
 *
 * @return the ActivityInfo
 */
public ActivityInfo getActivityInfo() {
    ActivityInfo activityInfo = new ActivityInfo();
    List<ActivityTypeInfo> activityTypeInfos = LogConversionUtil.getActivityTypeInfo();
    List<UserInfo> userInfos = userService.getAllUsers();
    activityInfo.setActivityTypeInfo(activityTypeInfos);
    activityInfo.setUserInfo(userInfos);
    return activityInfo;
}
Also used : ActivityInfo(org.openkilda.log.model.ActivityInfo) ActivityTypeInfo(org.openkilda.log.model.ActivityTypeInfo) UserInfo(org.usermanagement.model.UserInfo)

Example 17 with UserInfo

use of org.usermanagement.model.UserInfo in project open-kilda by telstra.

the class UserService method getLoggedInUserInfo.

/**
 * Gets the logged in user info.
 *
 * @return the logged in user info
 * @throws AccessDeniedException the access denied exception
 */
public UserInfo getLoggedInUserInfo() throws AccessDeniedException {
    RequestContext requestContext = serverContext.getRequestContext();
    if (requestContext.getUserId() == null) {
        throw new AccessDeniedException(messageUtils.getUnauthorizedMessage());
    }
    UserInfo userInfo = new UserInfo();
    userInfo.setUserId(requestContext.getUserId());
    userInfo.setUsername(requestContext.getUserName());
    userInfo.setIs2FaEnabled(requestContext.getIs2FaEnabled());
    userInfo.setStatus(requestContext.getStatus());
    userInfo.setName(requestContext.getFullName());
    userInfo.setPermissions(requestContext.getPermissions());
    return userInfo;
}
Also used : AccessDeniedException(java.nio.file.AccessDeniedException) UserInfo(org.usermanagement.model.UserInfo) RequestContext(org.openkilda.auth.model.RequestContext)

Aggregations

UserInfo (org.usermanagement.model.UserInfo)17 AccessDeniedException (java.nio.file.AccessDeniedException)6 RequestValidationException (org.usermanagement.exception.RequestValidationException)6 IntegrationException (org.openkilda.integration.exception.IntegrationException)4 InvalidResponseException (org.openkilda.integration.exception.InvalidResponseException)4 UserEntity (org.usermanagement.dao.entity.UserEntity)4 ArrayList (java.util.ArrayList)3 HttpSession (javax.servlet.http.HttpSession)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 RoleEntity (org.usermanagement.dao.entity.RoleEntity)3 RequestContext (org.openkilda.auth.model.RequestContext)2 InvalidOtpException (org.openkilda.exception.InvalidOtpException)2 OtpRequiredException (org.openkilda.exception.OtpRequiredException)2 TwoFaKeyNotSetException (org.openkilda.exception.TwoFaKeyNotSetException)2 StoreIntegrationException (org.openkilda.integration.exception.StoreIntegrationException)2 InventoryFlow (org.openkilda.integration.source.store.dto.InventoryFlow)2 InventorySwitch (org.openkilda.integration.source.store.dto.InventorySwitch)2 FlowInfo (org.openkilda.model.FlowInfo)2 SwitchInfo (org.openkilda.model.SwitchInfo)2