public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (parameter == null) { parameter = this.PropertyName; } if (value != null && parameter is string propertyName) { if (value is IDataBaseDescriptor descriptor) { if (propertyName == IsLoaded) { return(DataBaseDescriptorUtility.IsLoaded(Authenticator.Current, descriptor)); } } else { var prop = value.GetType().GetProperty(propertyName); if (prop != null) { return(prop.GetValue(value)); } } } return(value); }
public static bool CanDelete(Authentication authentication, IDataBaseDescriptor descriptor) { if (DataBaseDescriptorUtility.IsLoaded(authentication, descriptor) == true) { return(false); } return(authentication.Authority == Authority.Admin); }
public static bool CanUnload(Authentication authentication, IDataBaseDescriptor descriptor) { if (DataBaseDescriptorUtility.IsLoaded(authentication, descriptor) == false) { return(false); } if (descriptor is IPermissionDescriptor permissionDescriptor) { return(permissionDescriptor.AccessType >= AccessType.Owner); } return(authentication.Authority == Authority.Admin); }
public static bool CanLoad(Authentication authentication, IDataBaseDescriptor descriptor) { if (DataBaseDescriptorUtility.IsLoaded(authentication, descriptor) == true) { return(false); } if (descriptor is IAccessibleDescriptor accessibleDescriptor) { return(AccessibleDescriptorUtility.IsPrivate(authentication, accessibleDescriptor) == false && authentication.Authority == Authority.Admin); } return(authentication.Authority == Authority.Admin); }
protected async override void OnExecute(object parameter) { var dialog = new SelectDataBaseViewModel(this.authenticator, this.cremaAppHost, (s) => DataBaseDescriptorUtility.IsLoaded(this.authenticator, s) == false); if (await dialog.ShowDialogAsync() != true) { return; } if (DataBaseDescriptorUtility.IsLoaded(this.authenticator, dialog.SelectedItem) == true) { await AppMessageBox.ShowAsync("현재 사용중인 데이터베이스는 삭제할 수 없습니다."); return; } if (await new DeleteViewModel().ShowDialogAsync() != true) { return; } await DataBaseUtility.DeleteAsync(this.authenticator, dialog.SelectedItem); }