如何获得在SharePoint 2010中服务应用程序的权限 [英] How to get Service Application Permissions in SharePoint 2010

查看:114
本文介绍了如何获得在SharePoint 2010中服务应用程序的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是在SharePoint 2010中一个特定的服务应用程序读取帐户权限的最佳/最简单的方法是什么?
目前,我一直在瞎搞用:

What is the best/easiest way to read Account permissions on a particular Service Application in SharePoint 2010? Currently I have been messing around with:

    var solution = SPFarm.Local.Solutions["Service App Name.wsp"];
    var solutionPermissions = solution. //trying different options here



我已经通过了可以遵循什么解决方案的不同选项进行搜索。 但到目前为止,我很茫然。
任何想法?

I have been searching through the different options for what can follow "solution." But so far I am at a loss. Any ideas?

推荐答案

从的如何检查服务应用程序的权限可能对你有用:

foreach (SPService service in SPFarm.Local.Services)
{
    if (service.Name.Equals("ServiceName"))
    {
        foreach (SPServiceApplication serviceApp in service.Applications)
        {
            //This gets the service app administrators
            SPCentralAdministrationSecurity serviceAppSecurity = serviceApp.GetAdministrationAccessControl();
            SPAcl<SPCentralAdministrationRights> adminAcl = serviceAppSecurity.ToAcl();

            foreach (SPAce<SPCentralAdministrationRights> rights in adminAcl)
            {
                //Handle users
            }

            //This gets the users that can invoke the service app
            SPIisWebServiceApplication webServiceApp = (SPIisWebServiceApplication) app;
            SPIisWebServiceApplicationSecurity webServiceAppSecurity = webServiceApp.GetAccessControl();
            SPAcl<SPIisWebServiceApplicationRights> invokerAcl = webServiceAppSecurity.ToAcl();

            foreach (SPAce<SPIisWebServiceApplicationRights> rights in invokerAcl)
            {
                //Handle users
            }
        }
    }
}

这篇关于如何获得在SharePoint 2010中服务应用程序的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆