Package org.exist.security

Examples of org.exist.security.Permission


        // do not sort: order is important because permissions need to be read in the same order below
        // Arrays.sort( resources );

        final UserManagementService   mgtService   = (UserManagementService)current.getService( "UserManagementService", "1.0" );
        final Permission[]            perms        = mgtService.listResourcePermissions();
        final Permission              currentPerms = mgtService.getPermissions( current );


        if( dialog != null ) {
            dialog.setCollection( current.getName() );
            dialog.setResourceCount( resources.length );
View Full Code Here


        // permission string approach, otherwise we assume permissions are specified
        // in eXist's own syntax (user=+write,...).
       
        if( permissions.matches( UNIX_PERMS_REGEX ) ) {
          // Unix-style permissions string provided
          final Permission perm = UnixStylePermissionAider.fromString( permissions );
 
          if( res != null ) {
            service.chmod( res, perm.getMode() );
          } else {
            service.chmod( perm.getMode() );
          }
        } else {
          // eXist-style syntax for permission string (eg. user=+write,...)
          if( res != null ) {
             service.chmod( res, permissions );
View Full Code Here

        //if setUid or setGid, become Effective User
        EffectiveSubject effectiveSubject = null;
        final Source src = expression.getContext().getSource();
        if(src instanceof DBSource) {
            final DBSource dbSrc = (DBSource)src;
            final Permission perm = dbSrc.getPermissions();

            if(perm.isSetUid()) {
                if(perm.isSetGid()) {
                    //setUid and SetGid
                    effectiveSubject = new EffectiveSubject(perm.getOwner(), perm.getGroup());
                } else {
                    //just setUid
                    effectiveSubject = new EffectiveSubject(perm.getOwner());
                }
            } else if(perm.isSetGid()) {
                //just setGid, so we use the current user as the effective user
                effectiveSubject = new EffectiveSubject(callingUser, perm.getGroup());
            }
        }
       
        try {
            if(effectiveSubject != null) {
View Full Code Here

            // serializer writes to __contents__.xml
            final SAXSerializer serializer = (SAXSerializer)SerializerPool.getInstance().borrowObject( SAXSerializer.class );
            serializer.setOutput( contents, contentsOutputProps );

            final Permission perm = current.getPermissionsNoLock();
           
            serializer.startDocument();
            serializer.startPrefixMapping( "", Namespaces.EXIST_NS );
            final XmldbURI       uri  = current.getURI();
            final AttributesImpl attr = new AttributesImpl();
View Full Code Here

            finally {
                output.closeEntry();
            }
        }
       
        final Permission perms = doc.getPermissions();

        // store permissions
        final AttributesImpl attr = new AttributesImpl();
        attr.addAttribute( Namespaces.EXIST_NS, "type", "type", "CDATA", ( doc.getResourceType() == DocumentImpl.BINARY_FILE ) ? "BinaryResource" : "XMLResource" );
        attr.addAttribute( Namespaces.EXIST_NS, "name", "name", "CDATA", doc.getFileURI().toString() );
View Full Code Here

    public Permission getSubCollectionPermissions(Collection cParent, String name) throws XMLDBException {
        if(parent == null) {
            throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "collection is null");
        }

        Permission perm = null;
        try {
            perm = ((RemoteCollection)cParent).getSubCollectionPermissions(name);

            if(perm == null) {
           
View Full Code Here

    public Permission getSubResourcePermissions(Collection cParent, String name) throws XMLDBException {
        if(parent == null) {
            throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "collection is null");
        }

        Permission perm = null;
        try {
            perm = ((RemoteCollection)cParent).getSubCollectionPermissions(name);

            if(perm == null) {
           
View Full Code Here

            throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, pde.getMessage(), pde);
        }
    }

    private Permission getPermission(final String owner, final String group, final int mode, final List listOfAces) throws PermissionDeniedException {
        final Permission perm = PermissionAiderFactory.getPermission(owner, group, mode);
        if(perm instanceof ACLPermission && listOfAces != null && !listOfAces.isEmpty()) {
            final ACLPermission aclPermission = (ACLPermission)perm;
            for(final Object listOfAcesItem : listOfAces) {
                if(listOfAcesItem instanceof ACEAider) {
                    final ACEAider ace = (ACEAider)listOfAcesItem;
View Full Code Here

    public Permission[] listResourcePermissions() throws XMLDBException {
        try {
            final List<Object> params = new ArrayList<Object>(1);
            params.add(parent.getPath());
            final HashMap<?,?> result = (HashMap<?,?>) parent.getClient().execute("listDocumentPermissions", params);
            final Permission perm[] = new Permission[result.size()];
            final String[] resources = parent.listResources();
            Object[] t;
            for(int i = 0; i < resources.length; i++) {
                t = (Object[]) result.get(resources[i]);
View Full Code Here

    public Permission[] listCollectionPermissions() throws XMLDBException {
        try {
            final List<Object> params = new ArrayList<Object>(1);
            params.add(parent.getPath());
            final HashMap<?,?> result = (HashMap<?,?>) parent.getClient().execute("listCollectionPermissions", params);
            final Permission perm[] = new Permission[result.size()];
            final String collections[] = parent.listChildCollections();
            Object[] t;
            for (int i = 0; i < collections.length; i++) {
                t = (Object[]) result.get(collections[i]);
View Full Code Here

TOP

Related Classes of org.exist.security.Permission

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.