org.opencastproject.security.api.Organization.getId()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.opencastproject.security.api.Organization.getId()方法的一些代码示例,展示了Organization.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Organization.getId()方法的具体详情如下:
包路径:org.opencastproject.security.api.Organization
类名称:Organization
方法名:getId

Organization.getId介绍

暂无

代码示例

代码示例来源:origin: opencast/opencast

/**
 * {@inheritDoc}
 * 
 * @see org.opencastproject.security.api.UserProvider#getOrganization()
 */
@Override
public String getOrganization() {
 return organization.getId();
}

代码示例来源:origin: opencast/opencast

/**
 * {@inheritDoc}
 *
 * @see org.opencastproject.security.api.UserProvider#getOrganization()
 */
@Override
public String getOrganization() {
 return organization.getId();
}

代码示例来源:origin: opencast/opencast

/**
 * {@inheritDoc}
 *
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public boolean equals(Object obj) {
 if (!(obj instanceof Organization))
  return false;
 return ((Organization) obj).getId().equals(id);
}

代码示例来源:origin: opencast/opencast

@Override
public boolean equals(Object obj) {
 if (!(obj instanceof Organization))
  return false;
 return ((Organization) obj).getId().equals(id);
}

代码示例来源:origin: opencast/opencast

/**
  * {@inheritDoc}
  *
  * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
  *      javax.servlet.FilterChain)
  */
 @Override
 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
     throws IOException, ServletException {

  // Make sure we have an organization
  Organization org = securityService.getOrganization();
  if (org == null) {
   ((HttpServletResponse) response).sendError(HttpServletResponse.SC_NOT_FOUND);
   return;
  }

  // Get a hold of the security filter for that organization
  Filter filter = orgSecurityFilters.get(org.getId());
  if (filter == null) {
   ((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
   return;
  }
  filter.doFilter(request, response, chain);
 }
}

代码示例来源:origin: opencast/opencast

private void refresh() {
  final long now = System.currentTimeMillis();
  if (now - lastRefresh > refreshInterval) {
   byId.clear();
   byHost.clear();
   for (Organization org : persistence.getOrganizations()) {
    byId.put(org.getId(), org);
    // (host, port)
    for (Map.Entry<String, Integer> server : org.getServers().entrySet()) {
     byHost.put(tuple(server.getKey(), server.getValue()), org);
    }
   }
   lastRefresh = now;
  }
 }
}

代码示例来源:origin: opencast/opencast

public SecurityContext(SecurityService sec, Organization org, User user) {
 if (ne(org, user.getOrganization())) {
  throw new IllegalArgumentException("User is not a member of organization " + org.getId());
 }
 this.sec = sec;
 this.user = user;
 this.org = org;
}

代码示例来源:origin: opencast/opencast

@GET
 @Path("config.json")
 @Produces(MediaType.APPLICATION_JSON)
 @RestQuery(name = "configJson", description = "Paella configuration",
     reponses = {
      @RestResponse(description = "Returns the paella configuration", responseCode = HttpServletResponse.SC_OK)
     }, returnDescription = "")
 public String getMyInfo() throws IOException {
  // Add the current user's organizational information
  Organization org = securityService.getOrganization();
  File configFile = new File(PathSupport.concat(new String[] { paellaConfigFolder, org.getId(), "config.json" }));
  return FileUtils.readFileToString(configFile, "UTF-8");
 }
}

代码示例来源:origin: opencast/opencast

/**
 * Adds the organization to the list of organizations.
 *
 * @param organization
 *          the organization
 */
public void addOrganization(Organization organization) {
 boolean contains = persistence.containsOrganization(organization.getId());
 if (contains)
  throw new IllegalStateException("Can not add an organization with id '" + organization.getId()
      + "' since an organization with that identifier has already been registered");
 persistence.storeOrganization(organization);
 cache.invalidate();
 fireOrganizationRegistered(organization);
}

代码示例来源:origin: opencast/opencast

this.roles = new HashSet<JaxbRole>();
for (Role role : roles) {
 if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId()))
  throw new IllegalArgumentException("Role " + role + " is not from the same organization!");

代码示例来源:origin: opencast/opencast

/**
 * Constructs a user with the specified username, password, provider and roles.
 *
 * @param username
 *          the username
 * @param password
 *          the password
 * @param organization
 *          the organization
 * @param provider
 *          the provider
 * @param manageable
 *          whether the user is manageable
 * @param roles
 *          the roles
 */
public JpaUser(String username, String password, JpaOrganization organization, String provider, boolean manageable,
    Set<JpaRole> roles) {
 this(username, password, organization, null, null, provider, manageable);
 for (Role role : roles) {
  if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId()))
   throw new IllegalArgumentException("Role " + role + " is not from the same organization!");
 }
 this.roles = roles;
}

代码示例来源:origin: opencast/opencast

/**
 * Constructs a user with the specified username, name, email, login mechanism, last login date, organization and
 * roles.
 *
 * @param username
 *          the username
 * @param name
 *          the name
 * @param email
 *          the email address
 * @param loginMechanism
 *          the login mechanism
 * @param lastLogin
 *          the last login date
 * @param organization
 *          the organization
 * @param roles
 *          the roles
 */
public JpaUserReference(String username, String name, String email, String loginMechanism, Date lastLogin,
    JpaOrganization organization, Set<JpaRole> roles) {
 this(username, name, email, loginMechanism, lastLogin, organization);
 for (Role role : roles) {
  if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId()))
   throw new IllegalArgumentException("Role " + role + " is not from the same organization!");
 }
 this.roles = roles;
}

代码示例来源:origin: opencast/opencast

/**
 * Constructs a user with the specified username, password, name, email, provider and roles.
 *
 * @param username
 *          the username
 * @param password
 *          the password
 * @param organization
 *          the organization
 * @param name
 *          the name
 * @param email
 *          the email
 * @param provider
 *          the provider
 * @param manageable
 *          whether the user is manageable
 * @param roles
 *          the roles
 */
public JpaUser(String username, String password, JpaOrganization organization, String name, String email,
    String provider, boolean manageable, Set<JpaRole> roles) {
 this(username, password, organization, name, email, provider, manageable);
 for (Role role : roles) {
  if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId()))
   throw new IllegalArgumentException("Role " + role + " is not from the same organization!");
 }
 this.roles = roles;
}

代码示例来源:origin: opencast/opencast

public JpaJob(User currentUser, Organization organization, ServiceRegistrationJpaImpl creatingService,
    String operation, List<String> arguments, String payload, boolean dispatchable, float load) {
 this.creator = currentUser.getUsername();
 this.organization = organization.getId();
 this.creatorServiceRegistration = creatingService;
 this.jobType = creatingService.getServiceType();
 this.operation = operation;
 this.arguments = arguments;
 this.payload = payload;
 this.dispatchable = dispatchable;
 this.jobLoad = load;
 this.status = Status.INSTANTIATED.ordinal();
}

代码示例来源:origin: opencast/opencast

@Override
public boolean accepts(String baseUrl) {
 // Don't accept URLs without an organization context
 // (for example from the ServiceRegistry JobProducerHeartbeat)
 if (securityService.getOrganization() == null)
  return false;
 String orgId = securityService.getOrganization().getId();
 try {
  new URI(baseUrl);
  KeyEntry keyEntry = getKeyEntry(baseUrl);
  return ((keyEntry != null) && (StringUtils.equals(keyEntry.getOrganization(), ANY_ORGANIZATION)
      || StringUtils.equals(keyEntry.getOrganization(), orgId)));
 } catch (URISyntaxException e) {
  getLogger().debug("Unable to support url {} because", baseUrl, e);
  return false;
 }
}

代码示例来源:origin: opencast/opencast

/**
 * Get the URI for a static file resource depending on whether to get it direct from Opencast or from a webserver.
 *
 * @param uuid
 *          The unique identifier for the static file.
 * @return The URL for the static file resource.
 * @throws NotFoundException
 *           if the resource couldn't been found
 */
public URI getStaticFileURL(String uuid) throws NotFoundException {
 if (useWebserver && webserverURL.isSome()) {
  return URI.create(UrlSupport.concat(webserverURL.get(), securityService.getOrganization().getId(), uuid,
      staticFileService.getFileName(uuid)));
 } else {
  return URI.create(UrlSupport.concat(serverUrl, STATICFILES_URL_PATH, uuid));
 }
}

代码示例来源:origin: opencast/opencast

tx = em.getTransaction();
tx.begin();
JpaOrganization organizationEntity = getOrganizationEntity(org.getId(), em);
if (organizationEntity == null) {
 JpaOrganization organization = new JpaOrganization(org.getId(), org.getName(), org.getServers(),
     org.getAdminRole(), org.getAnonymousRole(), org.getProperties());
 em.persist(organization);

代码示例来源:origin: opencast/opencast

/**
 * Constructs an organization from an organization
 *
 * @param org
 *          the organization
 */
public static JaxbOrganization fromOrganization(Organization org) {
 if (org instanceof JaxbOrganization)
  return (JaxbOrganization) org;
 return new JaxbOrganization(org.getId(), org.getName(), org.getServers(), org.getAdminRole(),
     org.getAnonymousRole(), org.getProperties());
}

代码示例来源:origin: opencast/opencast

final Organization organization = securityService.getOrganization();
if (organization != null) {
 httpUriRequest.setHeader(SecurityConstants.ORGANIZATION_HEADER, organization.getId());
 final User currentUser = securityService.getUser();
 if (currentUser != null) {

代码示例来源:origin: opencast/opencast

if (securityService != null) {
 job.setCreator(securityService.getUser().getUsername());
 job.setOrganization(securityService.getOrganization().getId());

相关文章