clint
Posts: 135
Joined: Fri Jun 19, 2009 9:46 am
Location: Germany

Conditionally setting permissions on a folder

Hello,

I have a Main folder (with sub-folders and 150 files) in which permissions need to set under a certain condition.
Under one installation scenerio, I want to set the permissions for the main folder to everyone, and in another scenerio I don't want ot set the permissions at all.

I know how to set the permissions fpr a folder and how to set the condition for the feature component. But how do I set the permissions based on a condition?

Or do I need to do it the harder way, and create two separate folders and features with all the files and sub-folders duplicated?

I thought at first the Install folder content into the parent folder would help, but that seems wrong.

Maybe I can only do this with something like Xcacls and a custom action? If so, then what would be the steps to implement this?

Thank you!

clint
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Conditionally setting permissions on a folder

Hi Clint,

I'm afraid that there is no predefined support for setting permissions conditionally. As you already mentioned, the solution is to create two folders with the same content and place them in separate features, then set conditions for those features. You can also use the "Install folder content into the parent folder" option if you want.

To achieve this you can simply follow the steps below:
- create two new folders and set the "Install folder content into the parent folder" option for them
- set the permissions you want for each folder
- add your files into on of the two folders then copy and paste its content into the other folder
- create two new features in the "Organization" page (one for each folder)
- right-click on each folder and use the "Move to Feature" option to move the content of each folder in its own feature
- set the conditions you want for each feature
- build and run the project

Please keep in mind that even if you duplicate your files the way I described above, the size of your package will not increase.

If you want to use custom actions you can take a look on the "Cacls" or "Xcacls" articles.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
clint
Posts: 135
Joined: Fri Jun 19, 2009 9:46 am
Location: Germany

Re: Conditionally setting permissions on a folder

Hi Eusebiu,

Will then the parent folder inherit the Child's folder permissions when using "Install folder content into Parent folder"?

Thank you!
clint
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Conditionally setting permissions on a folder

Hi Clint,

Yes, the parent folder will inherit its child's folder permissions.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
clint
Posts: 135
Joined: Fri Jun 19, 2009 9:46 am
Location: Germany

Re: Conditionally setting permissions on a folder

Hello Eusebiu,

Thank you so much for your help and advice!

Really appreciated!

Best regards,
clint
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Conditionally setting permissions on a folder

You're welcome Clint. Glad to help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”