SOLVED

A question about permissions in SPFX

%3CLINGO-SUB%20id%3D%22lingo-sub-210589%22%20slang%3D%22en-US%22%3EA%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210589%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20it%20possible%20to%20set%20permissions%20to%20a%20web%20part%20written%20i%20SPFX%3F%26nbsp%3B%3C%2FP%3E%3CP%3EI%20mean%2C%20say%20I%20have%20a%20webpart%20that%20render%20a%20calendar%2C%20is%20possible%20to%20allow%20a%20specific%20SharePoint%20group%20to%20see%20the%20web%20part%20and%20hide%20it%20from%20the%20users%20that%20are%20not%20in%20the%20group%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EAmerico%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-210589%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-211433%22%20slang%3D%22en-US%22%3ERe%3A%20A%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211433%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20a%20lot%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9907%22%20target%3D%22_blank%22%3E%40Joel%20Rodrigues%3C%2FA%3E%26nbsp%3B!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20check%20the%20link%20and%20the%20information%20there.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20send%20you%20some%20messages%20if%20I%20feel%20that%20something%20isn't%20clear%20enough%20form%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EAmerico%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-211379%22%20slang%3D%22en-US%22%3ERe%3A%20A%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211379%22%20slang%3D%22en-US%22%3E%3CP%3ESure%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F117034%22%20target%3D%22_blank%22%3E%40Americo%20Perez%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20start%20here%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fcommunity%2Fcommunity%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fcommunity%2Fcommunity%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20extremely%20recommend%20that%20you%20join%20the%20community%20calls%20(calendar%20invites%20on%20the%20link)%20as%20you%20learn%20all%20the%20latest%20updates%20and%20have%20the%20chance%20to%20see%20some%20really%20great%20demos.%26nbsp%3BReally%20worth%20the%20time%20of%20you%20can%20make%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20also%20a%20youtube%20channel%20with%20lots%20of%20useful%20videos%20and%20recording%20from%20previous%20calls%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20top%20of%20that%2C%20you%20also%20have%20lots%20and%20lots%20of%20project%20samples%2C%20reusable%20projects%20and%20frameworks%20under%20the%20GitHub%20repository!%3C%2FP%3E%3CP%3ELinks%20to%20all%20of%20this%20available%20from%20the%20initial%20page%2C%20but%20let%20me%20know%20if%20you%20need%20any%20help%20to%20find%20something.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Echeers%2C%3C%2FP%3E%3CP%3EJoel%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-211247%22%20slang%3D%22en-US%22%3ERe%3A%20A%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211247%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Joel%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20you%20have%20link%20to%20PnP%20in%20general%3F%20I%20am%20new%20to%20PnP%20%3A)%3C%2Fimg%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EAmerico%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-211212%22%20slang%3D%22en-US%22%3ERe%3A%20A%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211212%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F117034%22%20target%3D%22_blank%22%3E%40Americo%20Perez%3C%2FA%3E%3C%2FP%3E%3CP%3EThe%20Security%20Trimmed%20Control%20from%20PnP%20Reusable%20Controls%20should%20be%20what%20you%20are%20looking%20for%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsharepoint.github.io%2Fsp-dev-fx-controls-react%2Fcontrols%2FSecurityTrimmedControl%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint.github.io%2Fsp-dev-fx-controls-react%2Fcontrols%2FSecurityTrimmedControl%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20are%20new%20to%20PnP%20reusable%20controls%2C%20you%20can%20find%20the%20information%20to%20get%20started%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsharepoint.github.io%2Fsp-dev-fx-controls-react%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint.github.io%2Fsp-dev-fx-controls-react%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-210894%22%20slang%3D%22en-US%22%3ERe%3A%20A%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210894%22%20slang%3D%22en-US%22%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20you%20have%20some%20link%20where%20I%20can%20see%20how%20it%20can%20be%20done%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3EAmerico%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-210680%22%20slang%3D%22en-US%22%3ERe%3A%20A%20question%20about%20permissions%20in%20SPFX%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210680%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20far%20as%20I%20know%20there%20is%20no%20way%20to%20hide%20a%20certain%20SPFx-based%20WebPart%20based%20on%20permissions%20to%20prevent%20users%20adding%20it%20to%20a%20page.%20You%20could%20check%20for%20permissions%20in%20your%20WebParts%20logic%20which%20makes%20it%20possible%20to%20alter%20the%20way%20your%20WebPart%20appears%20or%20behaves%20at%20runtime.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Regular Contributor

Hi,

 

Is it possible to set permissions to a web part written i SPFX? 

I mean, say I have a webpart that render a calendar, is possible to allow a specific SharePoint group to see the web part and hide it from the users that are not in the group? 

 

Best regards

Americo

6 Replies
Highlighted

As far as I know there is no way to hide a certain SPFx-based WebPart based on permissions to prevent users adding it to a page. You could check for permissions in your WebParts logic which makes it possible to alter the way your WebPart appears or behaves at runtime. 

Highlighted

Thanks!

 

Do you have some link where I can see how it can be done?

 

Regards

Americo

Highlighted

Hi @Americo Perez

The Security Trimmed Control from PnP Reusable Controls should be what you are looking for

https://sharepoint.github.io/sp-dev-fx-controls-react/controls/SecurityTrimmedControl/

 

If you are new to PnP reusable controls, you can find the information to get started here: https://sharepoint.github.io/sp-dev-fx-controls-react/

 

Hope this helps :)

Highlighted

Thanks Joel,

 

Do you have link to PnP in general? I am new to PnP :) 

 

Best regards

Americo

Highlighted
Best Response confirmed by Americo Perez (Regular Contributor)
Solution

Sure @Americo Perez

 

You can start here:

https://docs.microsoft.com/en-us/sharepoint/dev/community/community

 

I would extremely recommend that you join the community calls (calendar invites on the link) as you learn all the latest updates and have the chance to see some really great demos. Really worth the time of you can make it.

 

There is also a youtube channel with lots of useful videos and recording from previous calls

 

On top of that, you also have lots and lots of project samples, reusable projects and frameworks under the GitHub repository!

Links to all of this available from the initial page, but let me know if you need any help to find something.

 

cheers,

Joel

 

Highlighted

Thanks a lot @Joel Rodrigues !

 

I will check the link and the information there.

 

I will send you some messages if I feel that something isn't clear enough form me.

 

Best regards

Americo