本文整理汇总了Java中com.novell.ldap.LDAPException.INSUFFICIENT_ACCESS_RIGHTS属性的典型用法代码示例。如果您正苦于以下问题:Java LDAPException.INSUFFICIENT_ACCESS_RIGHTS属性的具体用法?Java LDAPException.INSUFFICIENT_ACCESS_RIGHTS怎么用?Java LDAPException.INSUFFICIENT_ACCESS_RIGHTS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.novell.ldap.LDAPException
的用法示例。
在下文中一共展示了LDAPException.INSUFFICIENT_ACCESS_RIGHTS属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddBoundFail
@Test
public void testAddBoundFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"uid=testuser,ou=users,dc=domain,dc=com","secret".getBytes());
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
示例2: testAddAnonFail
public void testAddAnonFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
示例3: testAddBoundFail
public void testAddBoundFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"uid=testuser,ou=users,dc=domain,dc=com","secret".getBytes());
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
示例4: testSearchGroupsBound
public void testSearchGroupsBound() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"uid=testuser,ou=users,dc=domain,dc=com","secret".getBytes());
try {
LDAPSearchResults res = con.search("ou=groups,dc=domain,dc=com",1,"(objectClass=*)",new String[0],false);
if (res.hasMore()) {
fail("has results : " + res.next());
}
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail ("did not throw error");
con.disconnect();
}
示例5: testAddAnonFail
@Test
public void testAddAnonFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
示例6: testSearchGroupsBound
@Test
public void testSearchGroupsBound() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"uid=testuser,ou=users,dc=domain,dc=com","secret".getBytes());
try {
LDAPSearchResults res = con.search("ou=groups,dc=domain,dc=com",1,"(objectClass=*)",new String[0],false);
if (res.hasMore()) {
fail("has results : " + res.next());
}
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail ("did not throw error");
con.disconnect();
}
示例7: checkPermisions
private void checkPermisions(AccessControlItem aci,boolean permision,String errMsg) throws LDAPException {
if (this.isNotAllowed(aci,permision)) {
throw new LDAPException(errMsg,LDAPException.INSUFFICIENT_ACCESS_RIGHTS,"");
}
}