org.springframework.security.acls.model.Acl.getObjectIdentity()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(209)

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

Acl.getObjectIdentity介绍

[英]Obtains the domain object this Acl provides entries for. This is immutable once an Acl is created.
[中]获取此Acl为其提供条目的域对象。一旦创建Acl,这是不可变的。

代码示例

代码示例来源:origin: spring-projects/spring-security

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("AclImpl[");
  sb.append("id: ").append(this.id).append("; ");
  sb.append("objectIdentity: ").append(this.objectIdentity).append("; ");
  sb.append("owner: ").append(this.owner).append("; ");
  int count = 0;
  for (AccessControlEntry ace : aces) {
    count++;
    if (count == 1) {
      sb.append("\n");
    }
    sb.append(ace).append("\n");
  }
  if (count == 0) {
    sb.append("no ACEs; ");
  }
  sb.append("inheriting: ").append(this.entriesInheriting).append("; ");
  sb.append("parent: ").append(
      (this.parentAcl == null) ? "Null" : this.parentAcl.getObjectIdentity()
          .toString());
  sb.append("; ");
  sb.append("aclAuthorizationStrategy: ").append(this.aclAuthorizationStrategy)
      .append("; ");
  sb.append("permissionGrantingStrategy: ").append(this.permissionGrantingStrategy);
  sb.append("]");
  return sb.toString();
}

代码示例来源:origin: spring-projects/spring-security

result.put(acl.getObjectIdentity(), acl);
aclFound = true;

代码示例来源:origin: spring-projects/spring-security

resultMap.put(result.getObjectIdentity(), result);

代码示例来源:origin: spring-projects/spring-security

if (this.acl.getObjectIdentity() == null) {
  if (rhs.acl.getObjectIdentity() != null) {
    return false;
  if (!this.acl.getObjectIdentity()
      .equals(rhs.getAcl().getObjectIdentity())) {
    return false;

代码示例来源:origin: spring-projects/spring-security

@Test
public void testAllParentsAreRetrievedWhenChildIsLoaded() throws Exception {
  String query = "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (6,2,103,1,1,1);";
  getJdbcTemplate().execute(query);
  ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(100));
  ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(101));
  ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(102));
  ObjectIdentity middleParent2Oid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(103));
  // Retrieve the child
  Map<ObjectIdentity, Acl> map = this.strategy.readAclsById(Arrays.asList(childOid), null);
  // Check that the child and all its parents were retrieved
  assertThat(map.get(childOid)).isNotNull();
  assertThat(map.get(childOid).getObjectIdentity()).isEqualTo(childOid);
  assertThat(map.get(middleParentOid)).isNotNull();
  assertThat(map.get(middleParentOid).getObjectIdentity()).isEqualTo(middleParentOid);
  assertThat(map.get(topParentOid)).isNotNull();
  assertThat(map.get(topParentOid).getObjectIdentity()).isEqualTo(topParentOid);
  // The second parent shouldn't have been retrieved
  assertThat(map.get(middleParent2Oid)).isNull();
}

代码示例来源:origin: spring-projects/spring-security

/**
 * Updates an existing acl_object_identity row, with new information presented in the
 * passed MutableAcl object. Also will create an acl_sid entry if needed for the Sid
 * that owns the MutableAcl.
 *
 * @param acl to modify (a row must already exist in acl_object_identity)
 *
 * @throws NotFoundException if the ACL could not be found to update.
 */
protected void updateObjectIdentity(MutableAcl acl) {
  Long parentId = null;
  if (acl.getParentAcl() != null) {
    Assert.isInstanceOf(ObjectIdentityImpl.class, acl.getParentAcl()
        .getObjectIdentity(),
        "Implementation only supports ObjectIdentityImpl");
    ObjectIdentityImpl oii = (ObjectIdentityImpl) acl.getParentAcl()
        .getObjectIdentity();
    parentId = retrieveObjectIdentityPrimaryKey(oii);
  }
  Assert.notNull(acl.getOwner(), "Owner is required in this implementation");
  Long ownerSid = createOrRetrieveSidPrimaryKey(acl.getOwner(), true);
  int count = jdbcOperations.update(updateObjectIdentity, parentId, ownerSid,
      Boolean.valueOf(acl.isEntriesInheriting()), acl.getId());
  if (count != 1) {
    throw new NotFoundException("Unable to locate ACL to update");
  }
}

代码示例来源:origin: spring-projects/spring-security

final ObjectIdentity oid = mock(ObjectIdentity.class);
when(mockAcl.getObjectIdentity()).thenReturn(oid);
Sid sid = new PrincipalSid("johndoe");

代码示例来源:origin: spring-projects/spring-security

assertThat(middleParent.getParentAcl().getObjectIdentity()).isEqualTo(topParentOid);
assertThat(child.getParentAcl().getObjectIdentity()).isEqualTo(middleParentOid);

代码示例来源:origin: spring-projects/spring-security

assertThat(middleParent.getParentAcl().getObjectIdentity()).isEqualTo(getTopParentOid());
assertThat(child.getParentAcl().getObjectIdentity()).isEqualTo(getMiddleParentOid());

代码示例来源:origin: spring-projects/spring-security

assertThat(childAcl.getParentAcl().getObjectIdentity()).isEqualTo(getMiddleParentOid());

代码示例来源:origin: codeabovelab/haven-platform

sb.append("parent: ").append((this.parentAcl == null) ? "Null" : this.parentAcl.getObjectIdentity().toString());
sb.append("; ");
sb.append("aclAuthorizationStrategy: ").append(this.aclAuthorizationStrategy).append("; ");

代码示例来源:origin: apache/servicemix-bundles

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("AclImpl[");
  sb.append("id: ").append(this.id).append("; ");
  sb.append("objectIdentity: ").append(this.objectIdentity).append("; ");
  sb.append("owner: ").append(this.owner).append("; ");
  int count = 0;
  for (AccessControlEntry ace : aces) {
    count++;
    if (count == 1) {
      sb.append("\n");
    }
    sb.append(ace).append("\n");
  }
  if (count == 0) {
    sb.append("no ACEs; ");
  }
  sb.append("inheriting: ").append(this.entriesInheriting).append("; ");
  sb.append("parent: ").append(
      (this.parentAcl == null) ? "Null" : this.parentAcl.getObjectIdentity()
          .toString());
  sb.append("; ");
  sb.append("aclAuthorizationStrategy: ").append(this.aclAuthorizationStrategy)
      .append("; ");
  sb.append("permissionGrantingStrategy: ").append(this.permissionGrantingStrategy);
  sb.append("]");
  return sb.toString();
}

代码示例来源:origin: apache/servicemix-bundles

result.put(acl.getObjectIdentity(), acl);
aclFound = true;

代码示例来源:origin: apache/servicemix-bundles

resultMap.put(result.getObjectIdentity(), result);

代码示例来源:origin: com.foreach.across.modules/spring-security-acl-module

@Transactional
@Override
public void changeAclParent( MutableAcl acl, ObjectIdentity parent ) {
  if ( acl != null ) {
    Acl parentAcl = acl.getParentAcl();
    if ( parent == null && parentAcl != null ) {
      acl.setParent( null );
      updateAcl( acl );
    }
    else if ( parent != null ) {
      Acl newParentAcl = getAcl( parent );
      if ( newParentAcl == null ) {
        newParentAcl = createAcl( parent );
      }
      if ( parentAcl == null || !parentAcl.getObjectIdentity().equals( newParentAcl.getObjectIdentity() ) ) {
        acl.setParent( newParentAcl );
        updateAcl( acl );
      }
    }
  }
}

代码示例来源:origin: apache/servicemix-bundles

if (this.acl.getObjectIdentity() == null) {
  if (rhs.acl.getObjectIdentity() != null) {
    return false;
  if (!this.acl.getObjectIdentity()
      .equals(rhs.getAcl().getObjectIdentity())) {
    return false;

代码示例来源:origin: apache/servicemix-bundles

/**
 * Updates an existing acl_object_identity row, with new information presented in the
 * passed MutableAcl object. Also will create an acl_sid entry if needed for the Sid
 * that owns the MutableAcl.
 *
 * @param acl to modify (a row must already exist in acl_object_identity)
 *
 * @throws NotFoundException if the ACL could not be found to update.
 */
protected void updateObjectIdentity(MutableAcl acl) {
  Long parentId = null;
  if (acl.getParentAcl() != null) {
    Assert.isInstanceOf(ObjectIdentityImpl.class, acl.getParentAcl()
        .getObjectIdentity(),
        "Implementation only supports ObjectIdentityImpl");
    ObjectIdentityImpl oii = (ObjectIdentityImpl) acl.getParentAcl()
        .getObjectIdentity();
    parentId = retrieveObjectIdentityPrimaryKey(oii);
  }
  Assert.notNull(acl.getOwner(), "Owner is required in this implementation");
  Long ownerSid = createOrRetrieveSidPrimaryKey(acl.getOwner(), true);
  int count = jdbcTemplate.update(updateObjectIdentity, parentId, ownerSid,
      Boolean.valueOf(acl.isEntriesInheriting()), acl.getId());
  if (count != 1) {
    throw new NotFoundException("Unable to locate ACL to update");
  }
}

代码示例来源:origin: codeabovelab/haven-platform

final String ownerTenantId = getTenantFromSid(ownerSid);
if(ownerTenantId == MultiTenancySupport.NO_TENANT) {
  throw new RuntimeException("Can not retrieve tenant from acl owner: acl.objectIdentity=" + acl.getObjectIdentity().getIdentifier());

代码示例来源:origin: codeabovelab/haven-platform

public Builder from(Acl aclData) {
  if(aclData instanceof MutableAcl) {
    this.setId((Long)((MutableAcl) aclData).getId());
  }
  final List<AccessControlEntry> srcEntries = aclData.getEntries();
  if(srcEntries != null) {
    final int size = srcEntries.size();
    final List<AceData> aceDatas = new ArrayList<>(size);
    for(int i = 0; i < size; ++i) {
      AccessControlEntry entry = srcEntries.get(i);
      AceData aceData = AceDataImpl.builder().from(entry).build();
      aceDatas.add(aceData);
    }
    this.setEntries(aceDatas);
  }
  this.setObjectIdentity(aclData.getObjectIdentity());
  this.setOwner(aclData.getOwner());
  Acl parentAcl = aclData.getParentAcl();
  if(parentAcl != null) {
    this.setParentAclData(AclDataImpl.builder().from(parentAcl).build());
  }
  this.setEntriesInheriting(aclData.isEntriesInheriting());
  return this;
}

代码示例来源:origin: sk.seges.acris/acris-security-spring

private AclSecuredObjectIdentityData updateAclObjectIdentity(MutableAcl acl) {
  AclSecuredObjectIdentityData aclo = getAclSecuredObjectIdentity(acl.getObjectIdentity());
  
  if (acl.getParentAcl() != null) {
    AclSecuredObjectIdentityData parentObjectIdentity = getAclSecuredObjectIdentity(acl.getParentAcl().getObjectIdentity());
    aclo.setParentObject(parentObjectIdentity);
  } else if (aclo.getParentObject() != null) {
    aclo.setParentObject(null);
  }
  aclObjectIdentityDao.merge(aclo);
  return aclo;
}

相关文章