private void _updateAvailableWorkUnits() { //Case 30817 (Case 30843: moved to here from onBeforeCreate) if (CswTools.IsPrimaryKey(CurrentWorkUnitId) && false == AvailableWorkUnits.CheckValue(CurrentWorkUnitId.ToString())) { AvailableWorkUnits.AddValue(CurrentWorkUnitId.ToString()); CurrentWorkUnitProperty.RelatedNodeId = CurrentWorkUnitId; CurrentWorkUnitProperty.SyncGestalt(); } CswNbtView View = _CswNbtResources.ViewSelect.restoreView(CurrentWorkUnitProperty.NodeTypeProp.ViewId); View.Clear(); View.SetVisibility(CswEnumNbtViewVisibility.Property, null, null); CswNbtMetaDataObjectClass WorkUnitOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.WorkUnitClass); CswNbtViewRelationship WorkUnitParent = View.AddViewRelationship(WorkUnitOC, false); foreach (string WorkUnitNodeId in AvailableWorkUnits.Value) { CswPrimaryKey pk = CswConvert.ToPrimaryKey(WorkUnitNodeId); WorkUnitParent.NodeIdsToFilterIn.Add(pk); } CurrentWorkUnitProperty.OverrideView(View); }
public void OnAvailableWorkUnitsChange(CswNbtNodeProp Prop, bool Creating) { _updateAvailableWorkUnits(); if (null == CurrentWorkUnitId || false == AvailableWorkUnits.CheckValue(CurrentWorkUnitId.ToString())) { CswPrimaryKey pk = CswConvert.ToPrimaryKey(AvailableWorkUnits.Value[0]); //we're always guarenteed there's at least one CurrentWorkUnitProperty.RelatedNodeId = pk; CurrentWorkUnitProperty.SyncGestalt(); } }
protected override void afterPopulateProps() { UsernameProperty.SetOnPropChange(OnUserNamePropChange); AvailableWorkUnits.SetOnPropChange(OnAvailableWorkUnitsChange); CurrentWorkUnitProperty.SetOnPropChange(OnCurrentWorkUnitPropertyChange); AccountLocked.SetOnPropChange(onAccountLockedPropChange); AvailableWorkUnits.InitOptions = InitAvailableWorkUnitsOptions; _updateAvailableWorkUnits(); // BZ 6941, 8288 // Set the Default View to use the selected User, rather than the logged in User //DefaultView.User = this; FavoriteViews.User = this; // BZ 8288 // Favorite Actions options should derive from Role's Action Permissions if (_RoleNode != null) { CswCommaDelimitedString NewYValues = new CswCommaDelimitedString(); foreach (CswNbtAction Action in _CswNbtResources.Actions) { if (_CswNbtResources.Permit.can(Action, this) && Action.ShowInList) { NewYValues.Add(Action.DisplayName.ToString()); } } this.FavoriteActions.YValues = NewYValues; } //BZ 9933 if (_CswNbtResources.CurrentNbtUser == null || !_CswNbtResources.CurrentNbtUser.IsAdministrator()) { this.FailedLoginCount.setHidden(value: true, SaveToDb: false); this.AccountLocked.setHidden(value: true, SaveToDb: false); } //case 27793: these are the properties that a user cannot edit -- not even his own if ((null == _CswNbtResources.CurrentNbtUser) || (false == _CswNbtResources.CurrentNbtUser.IsAdministrator())) { this.Role.setReadOnly(true, false); } //case 27793: Prevent non-adminsitrators from editing paswords, except their own if (IsPasswordReadOnly) { this.PasswordProperty.setReadOnly(true, false); } else { this.PasswordProperty.setReadOnly(false, false); } Role.SetOnPropChange(onRolePropChange); DateFormatProperty.SetOnPropChange(onDateFormatPropChange); TimeFormatProperty.SetOnPropChange(onTimeFormatPropChange); //Case 31084: only an administrator can edit other users' profiles if ((null == _CswNbtResources.CurrentNbtUser) || (false == _CswNbtResources.CurrentNbtUser.IsAdministrator() && UserId != _CswNbtResources.CurrentNbtUser.UserId)) { this.Node.setReadOnly(true, false); } }