1

Is there any way to manipulate feature.xml file to control its visibility from a specific group?

Thanks.

  • do you want to hide a feature from certain users? or just the visibility of the file? – Gwny Jul 17 '14 at 8:05
  • Hide/Disable button from user group. – user13408 Jul 17 '14 at 8:12
  • why don't you restrict the access to this button in the feature itself, like asking for the user group when the control/page is loading? – Gwny Jul 17 '14 at 13:10
0

this is not possible, when you deploy a feature its deployed to the whole web application and is visible to all sites be it site collection feature or site feature. There is no way to hide the feature based on groups/users access rights.

The solution that i can think of would be to create a hidden feature, this would then look at the current feature page (_layouts/ManageFeatures.aspx) its activated on, it would then check the user groups for the site. If users are within a custom group then they have access otherwsie hide the feature.

to hide the feature would be done through css and javascript. You need to inspect the feature page for its html, they are placed within tables and each feature is within a that contains the title.... you would need to use javascript to inspect the title within element. If its a feature you want to hide than user javascript to get the parent parent to hide it.

Its not complex but its not easy by any means! to make it more user friendly once you have it working with hard coded checks within a loop you can then remove the hard coded check to look up on a list instead, within the list it would contain the feature titles. The JS code will send a query with the current item the loop is under to send to the list. if it exists than hide if it returns nothing than show! this would mean you can add any feature title to the list to hide rather than having to ammend the js code to add or remove features you want to hide or show!

sorry havent got any code as its long winded (code wise) and dont have the time atm.

...........

just to clarifiy, the hidden feature is a container for the js code, its the js code that would be doing most of the working out. The feaure is there just to enable the js for that given site only when its enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy