Package jcifs.smb

Examples of jcifs.smb.ACE


    return false;
  }
 
  public void testFilterUnwantedAces() throws Exception {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);
    ACE unsupportedTypeAce = createACE(
        createSID(null, "Nobody", SID.SID_TYPE_WKN_GRP),
        AclAccess.PERMIT, AceType.DIRECT);
    ACE unsupportedBuiltinAce = createACE(
        createSID("BUILTIN", "Batch", SID.SID_TYPE_ALIAS),
        AclAccess.PERMIT, AceType.DIRECT);
    ACE unresolvedAce = createACE(
        new SID(new SID("S-1-16-696969"), SID.SID_TYPE_ALIAS,
                null, "S-1-16-696969", false),
        AclAccess.PERMIT, AceType.DIRECT);
    ACE noReadAccessAce = createACE(
        createSID(null, "NoReading", SID.SID_TYPE_DOM_GRP),
        AclAccess.PERMIT, AceType.DIRECT,
        ACE.FILE_WRITE_DATA | ACE.FILE_APPEND_DATA | ACE.FILE_WRITE_EA |
        ACE.FILE_EXECUTE | ACE.FILE_DELETE | ACE.FILE_WRITE_ATTRIBUTES |
        ACE.DELETE | ACE.WRITE_DAC | ACE.WRITE_OWNER | ACE.SYNCHRONIZE |
View Full Code Here


   *        inherited ACE and if INHERIT_ONLY inherit_only ACE will be created.
   * @param aceAccessMask the mask of access bits OR'd together
   */
  private ACE createACE(SID sid, AclAccess aclAccess, AceType aceInheritType,
                        int aceAccessMask) {
    ACE ace = createMock(ACE.class);
    expect(ace.getSID()).andStubReturn(sid);
    expect(ace.isAllow()).andStubReturn(aclAccess == AclAccess.PERMIT);
    expect(ace.getFlags()).andStubReturn(aceInheritType.flags);
    expect(ace.getAccessMask()).andStubReturn(aceAccessMask);
    replay(ace);
    return ace;
  }
View Full Code Here

  private final String defaultAceFormat =
      AclFormat.DOMAIN_BACKSLASH_USER.getFormat();

  public void testACLForFileAndShareAndIntersection () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);
    ACE fileAce = createACE("user1", true);
    ACE fileAce1 = createACE("user2", true);
    ACE [] fileAces = {fileAce, fileAce1};
    expect(smbFile.getSecurity()).andReturn(fileAces);
    //To ensure that we get same SID for checking equality
    ACE shareAce = fileAce;
    ACE shareAce1 = createACE("group1", false);
    ACE [] shareAces = {shareAce, shareAce1};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

    verify(shareAce1);
  }

  public void testACLForFileAndShareAndUnion () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);
    ACE fileAce = createACE("user1", true);
    ACE [] fileAces = {fileAce};
    expect(smbFile.getSecurity()).andReturn(fileAces);

    ACE shareAce = createACE("user2", true);
    ACE shareAce1 = createACE("group1", false);
    ACE [] shareAces = {shareAce, shareAce1};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

    verify(shareAce1);
  }

  public void testACLForFileLevelAClOnly() throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);
    ACE fileAce = createACE("user1", true);
    ACE [] fileAces = {fileAce};
    expect(smbFile.getSecurity()).andReturn(fileAces);

    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
View Full Code Here

  }

  public void testACLForShareLevelAclOnly () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);

    ACE shareAce = createACE("user2", true);
    ACE [] shareAces = {shareAce};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

  }

  public void testACLForShareLevelGroupAclOnly () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);

    ACE shareAce = createACE("accountants", false /* this will create a group ACE*/);
    ACE [] shareAces = {shareAce};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

    verify(smbFile);
  }

  public void testACLForIncorrectSecurityLevel () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);
    ACE fileAce = createACE("user1", true);
    ACE [] fileAces = {fileAce};
    expect(smbFile.getSecurity()).andReturn(fileAces);

    ACE shareAce = createACE("user2", true);
    ACE shareAce1 = createACE("group1", false);
    ACE [] shareAces = {shareAce, shareAce1};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

  }

  public void testACLForDomainNameStrippedOff () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);

    ACE shareAce = createACE("domain\\accountants", false /* this will create a group ACE*/);
    ACE [] shareAces = {shareAce};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

    verify(smbFile);
  }

  public void testACLForPresenceOfDenyShareLevelACE () throws IOException {
    SmbFileDelegate smbFile = createMock(SmbFileDelegate.class);
    ACE shareAce = createACE("accountants", false /*group ACE*/, true /*Deny ACE*/);
    ACE [] shareAces = {shareAce};
    expect(smbFile.getShareSecurity(true)).andReturn(shareAces);
    expect(smbFile.getURL()).andReturn(new URL("file","host","file"));
    expectLastCall().anyTimes();
    replay(smbFile);
View Full Code Here

TOP

Related Classes of jcifs.smb.ACE

Copyright © 2018 www.massapicom. 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.