Examples of IAuthorizationManager


Examples of com.agiletec.aps.system.services.authorization.IAuthorizationManager

   * Returns allowed groups
   * @param reqCtx The request context
   * @return allowed groups
   */
  private Collection<String> getAllowedGroups(RequestContext reqCtx) {
    IAuthorizationManager authManager = (IAuthorizationManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, reqCtx.getRequest());
    UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    List<Group> groups = authManager.getGroupsOfUser(currentUser);
    Set<String> allowedGroup = new HashSet<String>();
    Iterator<Group> iter = groups.iterator();
    while (iter.hasNext()) {
      Group group = iter.next();
      allowedGroup.add(group.getName());
View Full Code Here

Examples of com.agiletec.aps.system.services.authorization.IAuthorizationManager

*/
public abstract class AbstractSurveyWondenInterceptor extends AbstractInterceptor {
 
  protected String checkSurveyGroup(SurveyRecord survey, HttpServletRequest request) {
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    IAuthorizationManager authManager = (IAuthorizationManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, ServletActionContext.getRequest());
    if (!survey.getGroupName().equals(Group.FREE_GROUP_NAME)
        && !authManager.isAuthOnGroup(currentUser, Group.ADMINS_GROUP_NAME)
        && !authManager.isAuthOnGroup(currentUser, survey.getGroupName())) {
      return "userNotAllowedToSurvey";
    }
    return null;
  }
View Full Code Here

Examples of com.agiletec.aps.system.services.authorization.IAuthorizationManager

      throw new ApsSystemException("Error sending emails", t);
    }
  }

  public List<ContentMailInfo> getContentsToNotifyToUser(UserDetails user, List<ContentMailInfo> contentsToNotify) {
    IAuthorizationManager authManager = this.getAuthorizationManager();
    if (authManager.isAuthOnGroup(user, Group.ADMINS_GROUP_NAME)) {
      return contentsToNotify;
    } else {
      List<ContentMailInfo> contentsToNotifyToUser = new ArrayList<ContentMailInfo>();
      boolean onlyOwner = this.getConfig().isOnlyOwner();
      for (ContentMailInfo info : contentsToNotify) {
        String mainGroup = info.getMainGroup();
        boolean allowedContent = authManager.isAuthOnGroup(user, mainGroup);
        if (!allowedContent && !onlyOwner && info.getGroups()!=null) {
          for (String group : info.getGroups()) {
            if (authManager.isAuthOnGroup(user, group)) {
              allowedContent = true;
              break;
            }
          }
        }
View Full Code Here

Examples of com.agiletec.aps.system.services.authorization.IAuthorizationManager

      this._mailSenderScheduler = null;
    }
  }

  protected List<UserDetails> findContentOperators() throws ApsSystemException {
    IAuthorizationManager authManager = this.getAuthorizationManager();
    IUserManager userManager = this.getUserManager();
    IUserProfileManager profileManager = this.getProfileManager();
    List<UserDetails> systemUsers = userManager.getUsers();
    List<UserDetails> allowedUsers = new ArrayList<UserDetails>();
    for (UserDetails user : systemUsers){
      user.addAutorities(this.getRoleManager().getAuthorizationsByUser(user));
      if (authManager.isAuthOnPermission(user, Permission.SUPERVISOR) || authManager.isAuthOnPermission(user, "editContents")) {
        try {
          AbstractUser userDetails = (AbstractUser) user;
          IUserProfile profile = profileManager.getProfile(userDetails.getUsername());
          userDetails.setProfile(profile);
        } catch (Throwable t) {
View Full Code Here

Examples of com.agiletec.aps.system.services.authorization.IAuthorizationManager

    UserDetails user = null;
        IApiTokenizerManager tokenizerManager =
                (IApiTokenizerManager) ApsWebApplicationUtils.getBean(JpTokenApiSystemConstants.TOKENIZER_MANAGER, request);
        IAuthenticationProviderManager authenticationProvider =
                (IAuthenticationProviderManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHENTICATION_PROVIDER_MANAGER, request);
        IAuthorizationManager authorizationManager =
                (IAuthorizationManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, request);
        try {
            String username = tokenizerManager.getUser(entandoApiToken);
            user = authenticationProvider.getUser(username);
            if (null != user) {
                properties.put(SystemConstants.API_USER_PARAMETER, user);
            } else if (apiMethod.getRequiredAuth()) {
        throw new ApiException(IApiErrorCodes.API_AUTHENTICATION_REQUIRED, "Invalid or missing user for token '" + entandoApiToken + "'", Response.Status.UNAUTHORIZED);
      }
        } catch (Exception e) {
            if (apiMethod.getRequiredAuth()) {
                throw new ApiException(IApiErrorCodes.API_AUTHENTICATION_REQUIRED, "Authentication Required", Response.Status.UNAUTHORIZED);
            }
        }
        if (null == user && (apiMethod.getRequiredAuth() || null != apiMethod.getRequiredPermission())) {
            throw new ApiException(IApiErrorCodes.API_AUTHENTICATION_REQUIRED, "Authentication Required", Response.Status.UNAUTHORIZED);
        } else if (null != user && null != apiMethod.getRequiredPermission()
                && !authorizationManager.isAuthOnPermission(user, apiMethod.getRequiredPermission())) {
            throw new ApiException(IApiErrorCodes.API_AUTHORIZATION_REQUIRED, "Authorization Required", Response.Status.UNAUTHORIZED);
        }
  }
View Full Code Here

Examples of com.agiletec.aps.system.services.authorization.IAuthorizationManager

  public int doStartTag() throws JspException {
    RequestContext reqCtx = (RequestContext) this.pageContext.getRequest().getAttribute(RequestContext.REQCTX);
    ApsSystemUtils.getLogger().trace("EventsOfDayTag Invoked");
    try {
      this._calMan = (ICalendarManager) ApsWebApplicationUtils.getBean(CalendarConstants.CALENDAR_MANAGER, this.pageContext);
      IAuthorizationManager authorizatorManager = (IAuthorizationManager)
          ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, this.pageContext);
      this.extractRequiredDate();
      UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (authorizatorManager.isAuthOnGroup(currentUser, Group.ADMINS_GROUP_NAME)) {
        this.setAllowedGroups(null);
      } else {
        List<Group> userGroups = authorizatorManager.getUserGroups(currentUser);
        Set allowedGroup = new HashSet();
        allowedGroup.add(Group.FREE_GROUP_NAME);
        for (Group group : userGroups) {
          allowedGroup.add(group.getName());
        }
View Full Code Here

Examples of org.jresearch.flexess.client.IAuthorizationManager

    Properties properties = new Properties();
    properties.put("model_id", "com.jresearchsoft.flexess.examples.orders");
    properties.put("flexess_url", "http://localhost:8080/flexess");
    properties.store(stream, "Test properties for single model");

    IAuthorizationManager am = Flexess.getAuthorizationManager();
    Assert.assertNotNull(am);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.