__acl: add compatibility for deprecated parameters
This commit is contained in:
		
					parent
					
						
							
								91a6ecc701
							
						
					
				
			
			
				commit
				
					
						a5df0badaf
					
				
			
		
					 6 changed files with 47 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -20,6 +20,8 @@
 | 
			
		|||
 | 
			
		||||
# TODO check if filesystem has ACL turned on etc
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/acl" ]
 | 
			
		||||
then
 | 
			
		||||
    grep -E '^(default:)?(user|group):' "$__object/parameter/acl" \
 | 
			
		||||
    | while read -r acl
 | 
			
		||||
    do
 | 
			
		||||
| 
						 | 
				
			
			@ -34,3 +36,4 @@ do
 | 
			
		|||
            exit 1
 | 
			
		||||
        fi
 | 
			
		||||
    done
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,27 @@ acl_path="/$__object_id"
 | 
			
		|||
 | 
			
		||||
acl_is="$( cat "$__object/explorer/acl_is" )"
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/acl" ]
 | 
			
		||||
then
 | 
			
		||||
    acl_should="$( cat "$__object/parameter/acl" )"
 | 
			
		||||
elif
 | 
			
		||||
    [ -f "$__object/parameter/user" ] \
 | 
			
		||||
        || [ -f "$__object/parameter/group" ] \
 | 
			
		||||
        || [ -f "$__object/parameter/mask" ] \
 | 
			
		||||
        || [ -f "$__object/parameter/other" ]
 | 
			
		||||
then
 | 
			
		||||
    acl_should="$( for param in user group mask other
 | 
			
		||||
    do
 | 
			
		||||
        [ ! -f "$__object/parameter/$param" ] && continue
 | 
			
		||||
 | 
			
		||||
        echo "$param" | grep -Eq 'mask|other' && sep=:: || sep=:
 | 
			
		||||
 | 
			
		||||
        echo "$param$sep$( cat "$__object/parameter/$param" )"
 | 
			
		||||
    done )"
 | 
			
		||||
else
 | 
			
		||||
    echo 'no parameters set' >&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/default" ]
 | 
			
		||||
then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,12 @@ remove
 | 
			
		|||
   ``mask`` and ``other`` entries can't be removed, but only changed.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEPRECATED PARAMETERS
 | 
			
		||||
---------------------
 | 
			
		||||
Parameters ``user``, ``group``, ``mask`` and ``other`` are deprecated and they
 | 
			
		||||
will be removed in future versions. Please use ``acl`` parameter instead.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								cdist/conf/type/__acl/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__acl/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
mask
 | 
			
		||||
other
 | 
			
		||||
							
								
								
									
										3
									
								
								cdist/conf/type/__acl/parameter/optional_multiple
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cdist/conf/type/__acl/parameter/optional_multiple
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
acl
 | 
			
		||||
user
 | 
			
		||||
group
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
acl
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue