Proposed Answer Adding groups to a project

  • 2010年6月18日 6:42
     
     

    G'Day All,

    I'm butchering the Sample Proposal that came with the SDK for PS 2010.  When the user submits the Proposal summary I want to give specific groups permission to access the project based on the user's department.  I've been looking at the PSI and there appears to be some methods in there that might do the trick, but not really sure?  Any suggestions appreciated!

    Cheers,

すべての返信

  • 2010年6月18日 12:17
    所有者
     
     回答の候補
    yes you can use the PSI Security methods to achieve this.
    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
  • 2010年10月25日 22:51
     
     

    Thanks Christophe,

    Can you provide a bit more detail please?  I understand that it is possible to use the PSI to achieve this though I'm not sure of the specific methods.  I've been looking through the SDK documentation for quite some time but can't find any good examples.  I think I should be using the setGroups method passing a SecurityGroupsDataSet but not really sure if this is correct.  Basically I want to programmatically replicate the functionality of the webpage "EditProjectPermissions.aspx" but the PSI just seems really convoluted!

  • 2012年4月18日 3:33
     
     

    you can try as below:

    1. ReadProjectCategory

    WebSvcSecurity.SecurityProjectCategoriesDataSet ds = security.ReadProjectCategory(projectUid);

    2. if ds.ProjectCategories.Count > 0

    W_CAT_UID = ds.ProjectCategories[0].WSEC_CAT_UID;

    WebSvcSecurity.SecurityProjectCategoriesDataSet.UserRelationsRow UserRelaRow = ds.UserRelations.NewUserRelationsRow();
    UserRelaRow.RES_UID = resourceUid;
    UserRelaRow.WSEC_CAT_UID = W_CAT_UID;
    ds.UserRelations.AddUserRelationsRow(UserRelaRow);

    WebSvcSecurity.SecurityProjectCategoriesDataSet.UserPermissionsRow UserPermisRow = ds.UserPermissions.NewUserPermissionsRow();
    UserPermisRow.RES_UID = resourceUid;
    UserPermisRow.WSEC_CAT_UID = W_CAT_UID;
    UserPermisRow.WSEC_FEA_ACT_UID = PSLibrary.PSSecurityCategoryPermission.OpenProject;
    ds.UserPermissions.AddUserPermissionsRow(UserPermisRow);

    security.UpdateProjectCategories(ds);

    3. if ds.ProjectCategories.Count <= 0

    W_CAT_UID = Guid.NewGuid();
    WebSvcSecurity.SecurityProjectCategoriesDataSet.ProjectCategoriesRow PCateRow = ds.ProjectCategories.NewProjectCategoriesRow();
    PCateRow.PROJ_UID = projectUid;
    PCateRow.WSEC_CAT_UID = W_CAT_UID;
    ds.ProjectCategories.AddProjectCategoriesRow(PCateRow);

    WebSvcSecurity.SecurityProjectCategoriesDataSet.UserRelationsRow UserRelaRow = ds.UserRelations.NewUserRelationsRow();
    UserRelaRow.RES_UID = resourceUid;
    UserRelaRow.WSEC_CAT_UID = W_CAT_UID;
    ds.UserRelations.AddUserRelationsRow(UserRelaRow);

    WebSvcSecurity.SecurityProjectCategoriesDataSet.UserPermissionsRow UserPermisRow = ds.UserPermissions.NewUserPermissionsRow();
    UserPermisRow.RES_UID = resourceUid;
    UserPermisRow.WSEC_CAT_UID = W_CAT_UID;
    UserPermisRow.WSEC_FEA_ACT_UID = PSLibrary.PSSecurityCategoryPermission.OpenProject;
    ds.UserPermissions.AddUserPermissionsRow(UserPermisRow);

    security.CreateProjectCategories(ds);