Package org.exist.security

Examples of org.exist.security.Account


        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        CollectionManagementService cms = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
        Collection testCollection = cms.createCollection(TEST_COLLECTION);
        UserManagementService ums = (UserManagementService) testCollection.getService("UserManagementService", "1.0");
        // change ownership to guest
        Account guest = ums.getAccount(GUEST_UID);
        ums.chown(guest, guest.getPrimaryGroup());
        ums.chmod("rwxr-xr-x");
    }
View Full Code Here


            dbUri = XmldbURI.xmldbUriFor(uri);
        }
       
        final Collection root = DatabaseManager.getCollection(dbUri.toString(), username, password);
        final UserManagementService mgmt = (UserManagementService)root.getService("UserManagementService", "1.0");
        final Account dba  = mgmt.getAccount(SecurityManager.DBA_USER);
        if (dba == null) {
            throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, "'"+SecurityManager.DBA_USER+"' account can't be found.");
        }
        dba.setPassword(adminPassword);
        mgmt.updateAccount(dba);

        return adminPassword;
    }
View Full Code Here

                } else {
                    log( msg, Project.MSG_ERR );
                }

            } else {
                final Account usr = service.getAccount( name );

                if( usr == null ) {
                    final String msg = "User " + name + " not found";

                    if( failonerror ) {
View Full Code Here

    }

    public void checkPermissions(Collection collection, List<ErrorReport> errorList) {
        try {
            Permission perms = collection.getPermissions();
            Account owner = perms.getOwner();
            if (owner == null) {
                final ErrorReport.CollectionError error = new ErrorReport.CollectionError( ErrorReport.ACCESS_FAILED, "Owner account not found for collection: " + collection.getURI());
                error.setCollectionId( collection.getId() );
                error.setCollectionURI( collection.getURI() );
                errorList.add(error);
View Full Code Here

    }

    public ErrorReport checkPermissions(final DocumentImpl doc) {
        try {
            Permission perms = doc.getPermissions();
            Account owner = perms.getOwner();
            if (owner == null) {
                return new ErrorReport.ResourceError(ErrorReport.RESOURCE_ACCESS_FAILED, "Owner account not found for document " + doc.getFileURI());
            }
            Group group = perms.getGroup();
            if (group == null) {
View Full Code Here

              {setText(new String((byte[]) resource.getContent()));}
         
          // lock the resource for editing
          final UserManagementService service = (UserManagementService)
          client.current.getService("UserManagementService", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
          final Account user = service.getAccount(properties.getProperty("user")); //$NON-NLS-1$
          final String lockOwner = service.hasUserLock(resource);
          if(lockOwner != null) {
              if(JOptionPane.showConfirmDialog(this,
                      Messages.getString("DocumentView.6") + lockOwner + //$NON-NLS-1$
                      Messages.getString("DocumentView.7"), //$NON-NLS-1$
View Full Code Here

        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        CollectionManagementService cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        Collection testCollection = cms.createCollection(TEST_COLLECTION);
        UserManagementService ums = (UserManagementService) testCollection.getService("UserManagementService", "1.0");
        // change ownership to guest
        Account guest = ums.getAccount(GUEST_UID);
        ums.chown(guest, guest.getPrimaryGroup());
        ums.chmod("rwxr-xr-x");

        //store sample files as guest
        Collection testCollectionAsGuest = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
        File files[] = getShakespeareSamplesDirectory().listFiles(new XMLFilenameFilter());
View Full Code Here

   
    private TableModel getUsersTableModel() {
        if(usersTableModel == null) {
           
            try {
                final Account accounts[] = userManagementService.getAccounts();
               
                Arrays.sort(accounts, new AccountComparator());

                final String tableData[][] = new String[accounts.length][3];
                for(int i = 0; i < accounts.length; i++) {
View Full Code Here

        for(int i = 0; i < rowCount; i++) {
            usersTableModel.removeRow(0);
        }
       
        try {
            final Account accounts[] = userManagementService.getAccounts();

            Arrays.sort(accounts, new AccountComparator());

            for(int i = 0; i < accounts.length; i++) {
                usersTableModel.addRow(new String[]{
View Full Code Here

   
    private void miRemoveUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miRemoveUserActionPerformed

        final String selectedUsername = getSelectedUsername();
        try {
            final Account account = userManagementService.getAccount(selectedUsername);
            userManagementService.removeAccount(account);
       
            usersTableModel.removeRow(tblUsers.getSelectedRow());
        } catch(final XMLDBException xmldbe) {
            JOptionPane.showMessageDialog(this, "Could not remove user '" + selectedUsername + "': " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
View Full Code Here

TOP

Related Classes of org.exist.security.Account

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.