Search in sources :

Example 1 with DominoServer

use of lotus.notes.addins.DominoServer in project openliberty-domino by OpenNTF.

the class IdentityServlet method getUniqueGroupIds.

@SuppressWarnings("unchecked")
private String getUniqueGroupIds(String uniqueUserId) throws NotesException {
    Session session = NotesFactory.createSession();
    try {
        DominoServer server = new DominoServer(session.getUserName());
        String name = getUserSecurityName(uniqueUserId);
        List<String> names = new ArrayList<>((Collection<String>) server.getNamesList(name));
        // $NON-NLS-1$
        int starIndex = names.indexOf("*");
        if (starIndex > -1) {
            // Everything at and after this point should be a group or
            // pseudo-group (e.g. "*/O=SomeOrg")
            names = names.subList(starIndex, names.size());
        }
        // $NON-NLS-1$
        return String.join("\n", names);
    } finally {
        session.recycle();
    }
}
Also used : DominoServer(lotus.notes.addins.DominoServer) ArrayList(java.util.ArrayList) Session(lotus.domino.Session)

Example 2 with DominoServer

use of lotus.notes.addins.DominoServer in project org.openntf.domino by OpenNTF.

the class LogReader method canReadLogs.

/**
 * Whether or not the effective user of the Session has access to read logs
 *
 * @param session
 *            Session (remember you can use sessionAsSigner / sessionAsSignerWithFullAccess)
 * @return boolean whether user has access
 * @since org.openntf.domino.xsp 2.5.0
 */
private boolean canReadLogs(final lotus.domino.Session session) {
    boolean result = false;
    try {
        String username = session.getEffectiveUserName();
        DominoServer server = new DominoServer();
        result = server.checkServerAccess(username, ServerAccess.PROG_UNRESTRICTED);
        result = result || server.checkServerAccess(username, ServerAccess.VIEW_ONLY_ADMIN);
    } catch (NotesException ne) {
        ne.printStackTrace();
    }
    return result;
}
Also used : NotesException(lotus.domino.NotesException) DominoServer(lotus.notes.addins.DominoServer)

Example 3 with DominoServer

use of lotus.notes.addins.DominoServer in project org.openntf.domino by OpenNTF.

the class ServerProvider method processRequest.

@Override
public Object processRequest(FramedGraph graph, String item, MultivaluedMap<String, String> params) {
    Map<String, String> result = new LinkedHashMap<String, String>();
    try {
        Session session = Factory.getSession(SessionType.NATIVE);
        String serverName = session.getEffectiveUserName();
        DominoServer server = new DominoServer(serverName);
        result.put("servername", serverName);
        result.put("platform", server.getPlatform());
    } catch (Throwable t) {
        t.printStackTrace();
    }
    return result;
}
Also used : DominoServer(lotus.notes.addins.DominoServer) LinkedHashMap(java.util.LinkedHashMap) Session(org.openntf.domino.Session)

Example 4 with DominoServer

use of lotus.notes.addins.DominoServer in project org.openntf.domino by OpenNTF.

the class Name method getGroups.

@Override
@SuppressWarnings("unchecked")
public Collection<String> getGroups(final String serverName) {
    if (groupNames_ == null) {
        try {
            DominoServer server = new DominoServer(serverName);
            groupNames_ = server.getNamesList(getCanonical());
        } catch (NotesException e) {
            DominoUtils.handleException(e);
        }
    }
    return groupNames_;
}
Also used : NotesException(lotus.domino.NotesException) DominoServer(lotus.notes.addins.DominoServer)

Example 5 with DominoServer

use of lotus.notes.addins.DominoServer in project org.openntf.domino by OpenNTF.

the class NameODA method getGroups.

@SuppressWarnings("unchecked")
@Override
public Collection<String> getGroups(final String serverName) {
    Collection<String> result = null;
    try {
        DominoServer server = new DominoServer(serverName);
        result = server.getNamesList(getCanonical());
    } catch (NotesException e) {
        DominoUtils.handleException(e);
    }
    return result;
}
Also used : NotesException(lotus.domino.NotesException) DominoServer(lotus.notes.addins.DominoServer)

Aggregations

DominoServer (lotus.notes.addins.DominoServer)5 NotesException (lotus.domino.NotesException)3 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Session (lotus.domino.Session)1 Session (org.openntf.domino.Session)1