I have created a Sharepoint site which uses Custom-membership and custom-roles provider. I have hardcoded roles like “developer”,”software-engineer” and assigned these roles to some users.
I have a few custom web-parts in my site and I want to show/hide them based on the user role. For example, if the role is “Developer”, then hide the first web-part. I tried these approaches:
I edited the web-part in SP and went to target audience. I tried to add “Developer” in target audience, but the people picker does not pick my custom role. So this approach failed
I added a new share-point group called “DevelopersGroup”. In this group I added the role “Developer”. I then added this new group “DevelopersGroup” in the target audience of the web-part. But after this the web-part is not visible to anyone. Even the users whose role is developer cannot see it.
I think I can do this programmatically by using the webpart.hidden property, but I do not want to do this.
Can you please point to what I might be doing wrong. I would greatly appreciate any response. Thanks.