Hillbilly Tabify Forms [closed]
-
07-02-2021 - |
문제
I have this Script that uses Hillbilly Tabify on SharePoint Online
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://.sharepoint.com/sites/Sante-Securite/SiteAssets/JSJihen/jquery-ui.css" />
<script type="text/javascript" src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<script type="text/javascript" src="https://.sharepoint.com/sites/Sante-Securite/SiteAssets/JSJihen/jquery.HillbillyTabify.min.js"></script>
<div id="HillbillyTabifyDiv"><ul id="HillbillyTabify"></ul></div>
<script type="text/javascript">
jQuery(document).ready(function($) {
//the example below creates 3 tabs, you can create as many tabs as you'd like by adding additional objects.
//"Title" is the title of the tab and "size" is the number of fields to show in that tab
//If there are any remaining fields they will appear as normal below the tabs
var tabInfo = [
{title:"Informations sur la personne impliquée/blessée",size:5},
{title:"Information sur l'évènement",size:10},
{title:"Premiers soins et traitements (à remplir si applicable)",size:7}
];
HillbillyTabifyForms(tabInfo);
});
I want to restrict access of the 3rd tab only for certain persons by permission. How i can do it please?
해결책
If you are using a group to determine what users can see the 3rd tab, you can try something like this to selectively load the tab based on user being in a specific group:
jQuery(document).ready(function($) {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
var currentUser = web.get_currentUser();
var userGroups = currentUser.get_groups();
ctx.load(currentUser);
ctx.load(userGroups);
ctx.executeQueryAsync(
function(){
var groupEnum = userGroups.getEnumerator();
var tabInfo = [
{title:"Informations sur la personne impliquée/blessée",size:5},
{title:"Information sur l'évènement",size:10}
];
while(groupEnum.moveNext()){
var group = groupEnum.get_current();
if(group.get_title() == "<Group Name As String>"){
tabInfo.push({title:"Premiers soins et traitements (à remplir si applicable)",size:7});
break;
}
}
HillbillyTabifyForms(tabInfo);
},
function(sender, args){
console.error(args.get_message());
}
)
});
제휴하지 않습니다 sharepoint.stackexchange