إجابة مقترحة Adding groups to a project

  • 06/رجب/1431 06: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,

جميع الردود

  • 06/رجب/1431 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
  • 17/ذو القعدة/1431 10: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!

  • 26/جمادى الأولى/1433 03: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);