Пример #1
0
 /// <summary>
 /// Grant rights for record by right parameters
 /// </summary>
 /// <param name="rightsParams"><see cref="RightsParams"/> instance</param>
 public virtual void GrantRightsForRecord(RightsParams rightsParams)
 {
     foreach (var rightLevel in rightsParams.OperationsRights)
     {
         foreach (var operation in rightLevel.Value)
         {
             SetEntitySchemaRecordRightLevel(rightsParams.SysAdminUnitId, rightsParams.RecordId,
                                             operation, rightLevel.Key, rightsParams.SourceId);
         }
     }
 }
        private RightsParams GetLeadRightsParamsForGrantToPartner(Guid leadId, Guid partnerId)
        {
            var        rightsParams = new RightsParams(leadId, _defaultRightSource);
            PRMUtility utility      = new PRMUtility(UserConnection);

            rightsParams.SysAdminUnitId   = utility.GetPartnershipRoleByAccount(partnerId);
            rightsParams.OperationsRights = new Dictionary <EntitySchemaRecordRightLevel, List <EntitySchemaRecordRightOperation> > {
                {
                    EntitySchemaRecordRightLevel.Allow,
                    new List <EntitySchemaRecordRightOperation> {
                        EntitySchemaRecordRightOperation.Read, EntitySchemaRecordRightOperation.Edit
                    }
                }
            };
            return(rightsParams);
        }