private void CheckRights(Guid[] socialSubscriptionIds, Guid channelId, Terrasoft.Core.DB.SchemaRecordRightLevels rightLevel, string messageLocalizableString) { int result = 0; foreach (var socialSubscriptionId in socialSubscriptionIds) { var socialSubscriptionRightLevel = DBSecurityEngine.GetEntitySchemaRecordRightLevel("SocialSubscription", socialSubscriptionId); if ((socialSubscriptionRightLevel & rightLevel) != rightLevel) { result++; } } var socialChannelRightLevel = DBSecurityEngine.GetEntitySchemaRecordRightLevel("SocialChannel", channelId); if ((socialChannelRightLevel & rightLevel) != rightLevel) { result++; } if (result > 0) { throw new SecurityException(new LocalizableString(UserConnection.Workspace.ResourceStorage, "SocialSubscriptionService", messageLocalizableString)); } }
private static bool IsDenyDeleteFolderForCurrentUser(DBSecurityEngine engine, string entitySchemaName, Guid recordId) { var rightLevel = engine.GetEntitySchemaRecordRightLevel(entitySchemaName, recordId); return((rightLevel & SchemaRecordRightLevels.CanDelete) != SchemaRecordRightLevels.CanDelete); }
protected bool CheckReadFileAccess(EntitySchema entitySchema, Guid recordId) { DBSecurityEngine securityEngine = UserConnection.DBSecurityEngine; SchemaRecordRightLevels rights = securityEngine.GetEntitySchemaRecordRightLevel(entitySchema, recordId); return((rights & SchemaRecordRightLevels.CanRead) == SchemaRecordRightLevels.CanRead); }
private void CheckChannelEditRights(Guid socialChannelId) { var canEditRight = Terrasoft.Core.DB.SchemaRecordRightLevels.CanEdit; var schemaRightLevel = DBSecurityEngine.GetEntitySchemaRecordRightLevel("SocialChannel", socialChannelId); if ((schemaRightLevel & canEditRight) != canEditRight) { throw new SecurityException(new LocalizableString(UserConnection.Workspace.ResourceStorage, "SocialSubscriptionService", "LocalizableStrings.SubscriptionCanNotBeEdited.Value")); } }
/// <summary> /// Check right for entity. /// <returns>Flag of has right.</returns> /// </summary> protected virtual bool CheckSchemaRecordRight() { var schemaRightLevel = _securityEngine.GetEntitySchemaRecordRightLevel(Entity.SchemaName, Entity.PrimaryColumnValue); var hasRight = (schemaRightLevel & RecordRightOperation) == RecordRightOperation; if (!hasRight) { OperationException = new SecurityException(RightExceptionMessage); } return(hasRight); }
/// <summary> /// Checks whether current users has read access right for the feed. /// </summary> /// <param name="entitySchemaUId">Feed entity schema unique identifier.</param> /// <param name="primaryColumnValue">Feed unique identifier.</param> private void CheckChannelReadRights(Guid entitySchemaUId, Guid primaryColumnValue) { SchemaRecordRightLevels canReadRight = Terrasoft.Core.DB.SchemaRecordRightLevels.CanRead; ISchemaManagerItem <CoreEntitySchema> schemaItem = UserConnection.EntitySchemaManager.GetItemByUId(entitySchemaUId); SchemaRecordRightLevels schemaRightLevel = DBSecurityEngine.GetEntitySchemaRecordRightLevel(schemaItem.Name, primaryColumnValue); if ((schemaRightLevel & canReadRight) != canReadRight) { throw new SecurityException(new LocalizableString(UserConnection.Workspace.ResourceStorage, "SocialSubscriptionService", "LocalizableStrings.SocialChannelCanNotBeRead.Value")); } }
public bool CheckForecastItemRights(Guid forecastItemId, SchemaRecordRightLevels rightLevel) { bool result = true; DBSecurityEngine dbSecurityEngine = _userConnection.DBSecurityEngine; SchemaRecordRightLevels forecastItemRightLevel = dbSecurityEngine.GetEntitySchemaRecordRightLevel("ForecastItem", forecastItemId); if ((forecastItemRightLevel & rightLevel) != rightLevel) { result = false; } return(result); }
private void InnerCheckCanUnsubscribe(SocialSubscription socialSubscription) { if (!socialSubscription.CanUnsubscribe) { throw new InvalidOperationException(new LocalizableString(UserConnection.Workspace.ResourceStorage, "SocialSubscriptionService", "LocalizableStrings.SubscriptionCanNotBeCancelled.Value")); } var canDeleteRight = Terrasoft.Core.DB.SchemaRecordRightLevels.CanDelete; var schemaRightLevel = DBSecurityEngine.GetEntitySchemaRecordRightLevel("SocialSubscription", socialSubscription.Id); if ((schemaRightLevel & canDeleteRight) != canDeleteRight) { throw new SecurityException(new LocalizableString(UserConnection.Workspace.ResourceStorage, "SocialSubscriptionService", "LocalizableStrings.SubscriptionCanNotBeDeleted.Value")); } }