All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ztemplates.actions.security.ZRoles Maven / Gradle / Ivy

Go to download

java web framework - annotations - pojo - NO XML - state-free - clean, technology agnostic urls - REST - invisible to the web-client - JSP, Velocity, FreeMarker (others pluggable) - annotations for JavaScript/CSS dependencies - create reusable components

The newest version!
package org.ztemplates.actions.security;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class ZRoles
{
  private boolean secure = false;

  private boolean impossible = false;

  private Set roles = new HashSet();


  public void add(String[] r)
  {
    if (r.length > 0)
    {
      secure = true;
      if (roles.isEmpty())
      {
        Collections.addAll(roles, r);
      }
      else
      {
        Collection crt = new HashSet();
        Collections.addAll(crt, r);
        roles.retainAll(crt);
        if (roles.isEmpty())
        {
          impossible = true;
        }
      }
    }
  }


  public String toString()
  {
    return roles.toString();
  }


  public boolean isSecure()
  {
    return secure;
  }


  public boolean isImpossible()
  {
    return impossible;
  }


  public Set getRoles()
  {
    return roles;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy