當前位置: 首頁>>代碼示例>>Java>>正文


Java AuditableAccessControlEntry類代碼示例

本文整理匯總了Java中org.springframework.security.acls.model.AuditableAccessControlEntry的典型用法代碼示例。如果您正苦於以下問題:Java AuditableAccessControlEntry類的具體用法?Java AuditableAccessControlEntry怎麽用?Java AuditableAccessControlEntry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AuditableAccessControlEntry類屬於org.springframework.security.acls.model包,在下文中一共展示了AuditableAccessControlEntry類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AclEntry

import org.springframework.security.acls.model.AuditableAccessControlEntry; //導入依賴的package包/類
/**
 * Constructs a new <code>AclEntry</code> out of the provided <code>AccessControlEntry</code>.
 * 
 * @param ace the {@link AccessControlEntry} to use for parameter population.
 */
public AclEntry(AccessControlEntry ace) {
	granting = ace.isGranting();
	id = (String) ace.getId();
	mask = ace.getPermission().getMask();
	order = ace.getAcl().getEntries().indexOf(ace);
	
	if (ace.getSid() instanceof PrincipalSid) {
		sid = ((PrincipalSid) ace.getSid()).getPrincipal();
		sidPrincipal = true;
	} else if (ace.getSid() instanceof GrantedAuthoritySid) {
		sid = ((GrantedAuthoritySid) ace.getSid()).getGrantedAuthority();
		sidPrincipal = false;
	}
	
	if (ace instanceof AuditableAccessControlEntry) {
		auditSuccess = ((AuditableAccessControlEntry) ace).isAuditSuccess();
		auditFailure =  ((AuditableAccessControlEntry) ace).isAuditFailure();
	} else {
		auditSuccess = false;
		auditFailure = false;
	}
}
 
開發者ID:RigasGrigoropoulos,項目名稱:spring-security-acl-cassandra,代碼行數:28,代碼來源:AclEntry.java

示例2: from

import org.springframework.security.acls.model.AuditableAccessControlEntry; //導入依賴的package包/類
public Builder from(AccessControlEntry entry) {
    setId((Long) entry.getId());
    setPermission(entry.getPermission());
    setSid(entry.getSid());
    setGranting(entry.isGranting());
    if(entry instanceof AuditableAccessControlEntry) {
        AuditableAccessControlEntry aace = (AuditableAccessControlEntry) entry;
        setAuditFailure(aace.isAuditFailure());
        setAuditSuccess(aace.isAuditSuccess());
    }
    return this;
}
 
開發者ID:codeabovelab,項目名稱:haven-platform,代碼行數:13,代碼來源:AceDataImpl.java

示例3: toDBObject

import org.springframework.security.acls.model.AuditableAccessControlEntry; //導入依賴的package包/類
protected DBObject toDBObject(AccessControlEntry entry) {
    BasicDBObject dbo = new BasicDBObject();
    dbo.put(sidFieldName, toDBObject(entry.getSid()));
    dbo.put(maskFieldName, entry.getPermission().getMask());
    dbo.put(grantingFieldName, entry.isGranting());
    if (entry instanceof AuditableAccessControlEntry) {
        AuditableAccessControlEntry ace = (AuditableAccessControlEntry) entry;
        dbo.put(auditSuccessFieldName, ace.isAuditSuccess());
        dbo.put(auditFailureFieldName, ace.isAuditFailure());
    }
    return dbo;
}
 
開發者ID:cedac-software,項目名稱:spring-security-mongodb,代碼行數:13,代碼來源:MongoMutableAclService.java

示例4: readAclById_shouldLoadTheAcl

import org.springframework.security.acls.model.AuditableAccessControlEntry; //導入依賴的package包/類
@Test
public void readAclById_shouldLoadTheAcl() {
    Acl acl = fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));

    assertNotNull(acl);
    assertEquals("com.cedac.smartresidence.profile.domain.Home", acl.getObjectIdentity().getType());
    assertEquals("1", acl.getObjectIdentity().getIdentifier());
    assertNull(acl.getParentAcl());
    assertEquals(new PrincipalSid("[email protected]"), acl.getOwner());
    assertEquals(true, acl.isEntriesInheriting());
    assertEquals(6, acl.getEntries().size());

    assertEquals(0, acl.getEntries().get(0).getId());
    assertEquals(new GrantedAuthoritySid("ROLE_ADMIN"), acl.getEntries().get(0).getSid());
    assertEquals(BasePermission.READ, acl.getEntries().get(0).getPermission());
    assertEquals(true, acl.getEntries().get(0).isGranting());
    assertSame(acl, acl.getEntries().get(0).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(0)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(0)).isAuditFailure());

    assertEquals(1, acl.getEntries().get(1).getId());
    assertEquals(new GrantedAuthoritySid("ROLE_ADMIN"), acl.getEntries().get(1).getSid());
    assertEquals(BasePermission.WRITE, acl.getEntries().get(1).getPermission());
    assertEquals(true, acl.getEntries().get(1).isGranting());
    assertSame(acl, acl.getEntries().get(1).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(1)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(1)).isAuditFailure());

    assertEquals(2, acl.getEntries().get(2).getId());
    assertEquals(new GrantedAuthoritySid("ROLE_ADMIN"), acl.getEntries().get(2).getSid());
    assertEquals(BasePermission.ADMINISTRATION, acl.getEntries().get(2).getPermission());
    assertEquals(true, acl.getEntries().get(2).isGranting());
    assertSame(acl, acl.getEntries().get(2).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(2)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(2)).isAuditFailure());

    assertEquals(3, acl.getEntries().get(3).getId());
    assertEquals(new PrincipalSid("[email protected]"), acl.getEntries().get(3).getSid());
    assertEquals(BasePermission.READ, acl.getEntries().get(3).getPermission());
    assertEquals(true, acl.getEntries().get(3).isGranting());
    assertSame(acl, acl.getEntries().get(3).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(3)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(3)).isAuditFailure());

    assertEquals(4, acl.getEntries().get(4).getId());
    assertEquals(new PrincipalSid("[email protected]"), acl.getEntries().get(4).getSid());
    assertEquals(BasePermission.WRITE, acl.getEntries().get(4).getPermission());
    assertEquals(true, acl.getEntries().get(4).isGranting());
    assertSame(acl, acl.getEntries().get(4).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(4)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(4)).isAuditFailure());

    assertEquals(5, acl.getEntries().get(5).getId());
    assertEquals(new PrincipalSid("[email protected]"), acl.getEntries().get(5).getSid());
    assertEquals(BasePermission.READ, acl.getEntries().get(5).getPermission());
    assertEquals(true, acl.getEntries().get(5).isGranting());
    assertSame(acl, acl.getEntries().get(5).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(5)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(5)).isAuditFailure());
}
 
開發者ID:cedac-software,項目名稱:spring-security-mongodb,代碼行數:61,代碼來源:MongoAclServiceTests.java

示例5: readAclById_withSid_shouldLoadTheAcl

import org.springframework.security.acls.model.AuditableAccessControlEntry; //導入依賴的package包/類
@Test
public void readAclById_withSid_shouldLoadTheAcl() {
    Acl acl = fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"),
            Arrays.asList(new GrantedAuthoritySid("ROLE_ADMIN"), new PrincipalSid("[email protected]")));

    assertNotNull(acl);
    assertEquals("com.cedac.smartresidence.profile.domain.Home", acl.getObjectIdentity().getType());
    assertEquals("1", acl.getObjectIdentity().getIdentifier());
    assertNull(acl.getParentAcl());
    assertEquals(new PrincipalSid("[email protected]"), acl.getOwner());
    assertEquals(true, acl.isEntriesInheriting());
    assertEquals(6, acl.getEntries().size());
    assertEquals(true, acl.isSidLoaded(
            Arrays.asList(new GrantedAuthoritySid("ROLE_ADMIN"), new PrincipalSid("[email protected]"))));

    assertEquals(0, acl.getEntries().get(0).getId());
    assertEquals(new GrantedAuthoritySid("ROLE_ADMIN"), acl.getEntries().get(0).getSid());
    assertEquals(BasePermission.READ, acl.getEntries().get(0).getPermission());
    assertEquals(true, acl.getEntries().get(0).isGranting());
    assertSame(acl, acl.getEntries().get(0).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(0)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(0)).isAuditFailure());

    assertEquals(1, acl.getEntries().get(1).getId());
    assertEquals(new GrantedAuthoritySid("ROLE_ADMIN"), acl.getEntries().get(1).getSid());
    assertEquals(BasePermission.WRITE, acl.getEntries().get(1).getPermission());
    assertEquals(true, acl.getEntries().get(1).isGranting());
    assertSame(acl, acl.getEntries().get(1).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(1)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(1)).isAuditFailure());

    assertEquals(2, acl.getEntries().get(2).getId());
    assertEquals(new GrantedAuthoritySid("ROLE_ADMIN"), acl.getEntries().get(2).getSid());
    assertEquals(BasePermission.ADMINISTRATION, acl.getEntries().get(2).getPermission());
    assertEquals(true, acl.getEntries().get(2).isGranting());
    assertSame(acl, acl.getEntries().get(2).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(2)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(2)).isAuditFailure());

    assertEquals(3, acl.getEntries().get(3).getId());
    assertEquals(new PrincipalSid("[email protected]"), acl.getEntries().get(3).getSid());
    assertEquals(BasePermission.READ, acl.getEntries().get(3).getPermission());
    assertEquals(true, acl.getEntries().get(3).isGranting());
    assertSame(acl, acl.getEntries().get(3).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(3)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(3)).isAuditFailure());

    assertEquals(4, acl.getEntries().get(4).getId());
    assertEquals(new PrincipalSid("[email protected]"), acl.getEntries().get(4).getSid());
    assertEquals(BasePermission.WRITE, acl.getEntries().get(4).getPermission());
    assertEquals(true, acl.getEntries().get(4).isGranting());
    assertSame(acl, acl.getEntries().get(4).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(4)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(4)).isAuditFailure());

    assertEquals(5, acl.getEntries().get(5).getId());
    assertEquals(new PrincipalSid("[email protected]"), acl.getEntries().get(5).getSid());
    assertEquals(BasePermission.READ, acl.getEntries().get(5).getPermission());
    assertEquals(true, acl.getEntries().get(5).isGranting());
    assertSame(acl, acl.getEntries().get(5).getAcl());
    assertEquals(false, AuditableAccessControlEntry.class.cast(acl.getEntries().get(5)).isAuditSuccess());
    assertEquals(true, AuditableAccessControlEntry.class.cast(acl.getEntries().get(5)).isAuditFailure());
}
 
開發者ID:cedac-software,項目名稱:spring-security-mongodb,代碼行數:64,代碼來源:MongoAclServiceTests.java


注:本文中的org.springframework.security.acls.model.AuditableAccessControlEntry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。